HomeFreeBSD

seq: disable preemption around seq_write_*

Description

seq: disable preemption around seq_write_*

This is a long standing performance bug which happened to not cause trouble
in practice due to rather limited use of these primitives.

The read side expects the writer to finish soon(tm) hence it loops with one
pause in-between. But it is possible the writer gets preempted in which case
the waiting can take a long time, especially so if it got preempted by the
reader. In principle this may never clean itself up.

In the current kernel seq is only used to obtain stable fp + capabilities
state. In order for looping at least once to occur there has to be a
concurrent writer modifying the fd slot for the very fd we are trying to
read. That is, for any looping to occur in the first place the program has
to be multithreaded and be doing something fishy to begin with. As such,
the indefinite looping is rather hard to run into unless you really try
(and I did not).

Details

Provenance
mjgAuthored on
Parents
rS331658: Fix another optional standard. Build openpic_ofw again.
Branches
Unknown
Tags
Unknown