[idea] RAMDISK OOM problem - suggestion.

Tigran Aivazian (tigran@ocston.org)
Tue, 28 Dec 1999 12:41:45 -0800 (PST)


Hello World,

Here are my thoughts, if you care:

Problem: a block device driver (e.g. ramdisk) can go on
protecting infinite amount of buffers causing VM to OOM.

Idea: if it appears to impose overhead for the normal case to
solve this in buffer cache layer then I suggest that we deal with it
in RAMDISK driver individually.

Suggestion:

Let us maintain an array of bitmaps, one per each device minor,
with all bits cleared initially. Then, in rd_request() we set a bit
on WRITE and calculate the "hamming weight" over all minors and if
that exceeds some preset maximum (based on nr_free_pages or specified
as MODULE_PARM) then we end_request(0). We need a bitmap and not a simple
count because we can WRITE the same block multiple times.

Now, the problem with the above is that once the maximum is reached the
driver will be completely "stuck". This can be overcome thus: a new ioctl
is provided that invalidates buffers for a given minor. The current
invalidate_buffers() cannot do that but it should be possible to write a
invalidate_buffers_minor() (same, just a different test before "continue"?).

What think ye?

Also, the first step towards sanity would be to disallow individual ramdisk size
to go above nr_free_pages at rd_init() step but that is not a solution, of course.

Regards,
Tigran.

-
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/