tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: netbsd version of compressed caching

I have given this a shot. I have implemented the compressed caching
system as an LKM module and tried it on qemu with the 4.0.1 stable
release. For a while things seemed to work but when I put the system
under memory stress, system freezes after a while. My conclusion is
that this has something to to with how compressed caching pseudo
driver allocates memory but I am confused as to why this happens.

Compressed caching module is configured as a swap device and it
advertises a certain memory size. This size is determined by the
maximum number of pages it will compress. It tries to allocate memory
dynamically as the system swaps to the device. If, during a write, it
cannot allocate memory (no wait allocation) to store the compressed
page, it returns ENOMEM error to the caller. It seems that
uvm_aio_aiodone considers this a temporary error and just frees the
swap slot, however after a while the system freezes during my tests.
My guess was that these freezes were due to the ENOMEM errors. To try
this out, I tried a very dumb pseudo  device which advertises some
memory but returns ENOMEM for every write attempt to the device. My
configuration had 128MB of RAM, ~128MB of one real swap device at
priority 0 and a pseudo swap device which advertises ~12MB of memory
but which does no memory allocation at all and just returns ENOMEM
error on every write attempt. This pseudo swap device was also at
priority level 0. When I run my tests under this configuration, the
system consistently freezes after a while.  Same tests run fine with
only the real swap device configured.

Is this behavior expected and what is the explanation for it?  I would
appreciate any help.


On Sat, Dec 20, 2008 at 5:06 PM, Adam Hamsik <> wrote:
> On Dec,Saturday 13 2008, at 12:53 AM, Selcuk AYA wrote:
>> Here is my initial thoughts about how things should be done:
>> a) The whole thing will be a pseudo block device driver implemented as
>> an lkm. Block size of the device will be set to the page size so that
>> IO will be done in page aligned and page sized blocks.  Size of the
>> device will be the number of pages that the block device is configured
>> to compress. The size can be set through an ioctl command.
> Now when haad-dm was merged you can probably try to use device-mapper driver
> [sys/dev/dm] to implement pseudo block device.
> Regards
> Adam.

Home | Main Index | Thread Index | Old Index