Re: [patch] flushpage and buffercache size

Linus Torvalds (torvalds@transmeta.com)
Tue, 3 Aug 1999 12:49:08 -0700 (PDT)


On Tue, 3 Aug 1999, Andrea Arcangeli wrote:
>
> The current (2.3.12) flushpage done over a whole page (to release all the
> bh headers) is doing:
>
> if (!offset) {
> if (!try_to_free_buffers(page))
> atomic_add(PAGE_CACHE_SIZE, &buffermem);
> }
>
> But IMO the try_to_free_buffers() should never fail (well except in
> the ramdisk case that seems to be not addressed yet). The buffer is
> trashed, it's been completly invalidated and there's no reason for left it
> in memory.

What if somebody was in the process of reading from an old-style buffer
head, or had a count active on a buffer? bdflush might have raced with the
free logic - the IO has ended, but bdflush still has bh->b_count elevated
or something.

In short, I'm certain that the current code is safe. I'm not sure at all
that your suggestion is safe.

Linus

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/