Re: [PATCH 1/2] [mmotm] Add notifiers for various swap events

Andi Kleen
2009-12-28T15:02:19Z

Nitin Gupta <ngupta@vflare.org> writes:

> Events:
> - Swapon
> - Swapoff
> - When a swap slot is freed
>
> This is required for ramzswap module which implements RAM based block
> devices to be used as swap disks. These devices require a notification
> on these events to function properly.

The first question to ask is if compressed swap is worth
it. Do you have benchmark numbers showing it to be an improvement?
Are there cases where it is slower than uncompressed swap?

> Currently, I'm not sure if any of these event notifiers have any other
> users. However, adding ramzswap specific hooks instead of this generic
> approach resulted in a bad/hacky code.

If there's only a single user I think it's preferable to call
directly. That makes the code much easier to read and understand.
In the end notifiers are a form of code obfuscation.

The main use for notifiers would be if something is a optional
module, but that's not the case here.

-Andi

--
ak@linux.intel.com -- Speaking for myself only.