public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Thanos Makatos <mcatos@ics.forth.gr>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: Full buffer cache not working properly
Date: Mon, 16 Jul 2007 23:16:25 -0700	[thread overview]
Message-ID: <20070716231625.e2bdbc01.akpm@linux-foundation.org> (raw)
In-Reply-To: <469634B6.1070901@ics.forth.gr>

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.


      reply	other threads:[~2007-07-17  6:17 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-12 14:03 Full buffer cache not working properly Thanos Makatos
2007-07-17  6:16 ` Andrew Morton [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070716231625.e2bdbc01.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mcatos@ics.forth.gr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox