[lkml]   [1998]   [Aug]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectQuestions: bforget & forgotten pages

For nefarious reasons of my own, I'm interested in keeping buffer usage
constant, in a system with only the rd block device. I've started out by
populating the ram disk with an un-holey filesystem image, and from there
it does a good job of not using more or less memory -- with one exception.

I finally figured out what was causing a bizarre "leak": the bforget
function which is invoked by ext2/truncate.c -- and _only_ by that code,
at least in 2.0.33. In the process of truncating a file, bforget is
invoked on the discarded buffers, which removes the protected bits (thus
turning the pages loose from the ram disk), and resets the device numbers
to zero without moving the page to the free list. The former is just
annoying, but the latter seems to have the fairly bizarre effect of
leaving "zombie" clean buffers around that, as far as I can tell, will not
be reclaimed or reused by anything short of try_to_free_buffer, or the
inner machinations of refill_freelist.

So, two questions: can I replace bforget in the ext2 code with something
else, brelse perhaps? (It's not obvious whether their semantics are
identical.) Secondly, am I mistaken about forgotten pages, and are they
reclaimable via some process I've missed?

(I've not tried to demonstrate this on a stock Linux system, but the
principle is simple enough: create a ramdisk, create an ext2fs on that
ramdisk, create a file on that fs, then truncate that file. Some of the
ramdisk buffers will transmute into clean buffers with dev=NULLDEV. More
interestingly, if you repeatedly create and truncate a file, you'll
continually spawn more forgotten buffers. I'm not positive that this will
happen without the ram disk. I'm fairly sure that all of this isn't just
the symptom of some bug of mine, but I can't swear to that either,

Thanks for any assistance,
Kenneth Albanowski (, CIS: 70705,126)

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
Please read the FAQ at

 \ /
  Last update: 2005-03-22 13:44    [W:0.123 / U:0.024 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site