public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Thanos Makatos <mcatos@ics.forth.gr>
To: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Full buffer cache not working as expected
Date: Thu, 12 Jul 2007 19:43:39 +0300	[thread overview]
Message-ID: <46965A3B.1050503@ics.forth.gr> (raw)

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().


                 reply	other threads:[~2007-07-12 16:41 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=46965A3B.1050503@ics.forth.gr \
    --to=mcatos@ics.forth.gr \
    --cc=linux-kernel@vger.kernel.org \
    /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