* Full buffer cache not working properly
@ 2007-07-12 14:03 Thanos Makatos
2007-07-17 6:16 ` Andrew Morton
0 siblings, 1 reply; 2+ messages in thread
From: Thanos Makatos @ 2007-07-12 14:03 UTC (permalink / raw)
To: Linux Kernel Mailing List
I run several times the following test and what I've seen is that when
the buffer cache becomes full, unneeded dirty buffer heads are not evicted
and no other memory allocation can happen (including reading a block
from the disk to the buffer cache). Should this happen?
Here's the code that reproduces this issue:
for(i = 0; i < get_capacity(bdev->bd_disk)/8; i++) {
bh = __bread(bdev, i, PAGE_SIZE);
lock_buffer(bh);
memset(bh->b_data, 0, PAGE_SIZE);
set_buffer_dirty(bh);
unlock_buffer(bh);
__brelse(bh);
}
I added some printks printing the buffer head's reference counter: after
the '__bread' ref count is 2, after '__brelse' ref count is 1. Shouldn't
these
numbers be 1 and 0 respectively? I added an extra 'put_bh' before (or
after) the '__brelse' but I get a BUG().
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Full buffer cache not working properly
2007-07-12 14:03 Full buffer cache not working properly Thanos Makatos
@ 2007-07-17 6:16 ` Andrew Morton
0 siblings, 0 replies; 2+ messages in thread
From: Andrew Morton @ 2007-07-17 6:16 UTC (permalink / raw)
To: Thanos Makatos; +Cc: Linux Kernel Mailing List
On Thu, 12 Jul 2007 17:03:34 +0300 Thanos Makatos <mcatos@ics.forth.gr> wrote:
> I run several times the following test and what I've seen is that when
> the buffer cache becomes full, unneeded dirty buffer heads are not evicted
> and no other memory allocation can happen (including reading a block
> from the disk to the buffer cache). Should this happen?
> Here's the code that reproduces this issue:
>
> for(i = 0; i < get_capacity(bdev->bd_disk)/8; i++) {
> bh = __bread(bdev, i, PAGE_SIZE);
> lock_buffer(bh);
> memset(bh->b_data, 0, PAGE_SIZE);
> set_buffer_dirty(bh);
> unlock_buffer(bh);
> __brelse(bh);
> }
>
> I added some printks printing the buffer head's reference counter: after
> the '__bread' ref count is 2, after '__brelse' ref count is 1. Shouldn't
> these
> numbers be 1 and 0 respectively? I added an extra 'put_bh' before (or
> after) the '__brelse' but I get a BUG().
You've been very unkind to the VFS. Put a balance_dirty_pages() call in
that loop to give the system an opportunity to do some writeback and
throttling.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-07-17 6:17 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-12 14:03 Full buffer cache not working properly Thanos Makatos
2007-07-17 6:16 ` Andrew Morton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox