Re: small patch to buffer.c (2.0.x, stop wasting cycles).

Stephen C. Tweedie (sct@dcs.ed.ac.uk)
Sat, 5 Apr 1997 23:55:58 +0100


Hi,

On Fri, 4 Apr 1997 15:58:40 -0400 (CST), Gordon Oliver <gordo@lazos.cl> said:

> ...Ingo Molnar says...:
>> is the buffer-head freelist modified from interrupt handlers? If yes the
>> it's unsafe to call put_unused_buffer_head with irqs on. If no then no
>> need to cli at all.

> as far as I can tell put_unused_buffer head is never called from an
> interrupt (I doubt it is, as the original code also had an unprotected
> call, and the comments claim not). If it is, the patch doesn't fix the bug
> in the original code...

> Interrupts do, however, modify the reuse_list, thus the cli()/restore_flags()
> to protect the access to reuse_list. (unlock_buffer is called from various
> interrupts, and will add data to reuse_list)

Correct. The reuse list was added specifically to allow us to return
buffers to the free list from inside interrupts without having to make
the whole of the buffer code interrupt-safe. You do need to be
interrupt-protected any time you access the reuse list, but we never
move buffers from the reuse list to the free list from irqs so the
free list itself does not need that protection.

Cheers,
Stephen.