From: Nitin Gupta <ngupta@vflare.org>
To: Andi Kleen <andi@firstfloor.org>
Cc: Hugh Dickins <hugh.dickins@tiscali.co.uk>,
Pekka Enberg <penberg@cs.helsinki.fi>,
KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
Andrew Morton <akpm@linux-foundation.org>,
linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/2] [mmotm] Add notifiers for various swap events
Date: Mon, 28 Dec 2009 21:07:51 +0530 [thread overview]
Message-ID: <4B38D0CF.9000403@vflare.org> (raw)
In-Reply-To: <87eimf87m5.fsf@basil.nowhere.org>
On 12/28/2009 08:32 PM, Andi Kleen wrote:
> 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?
>
http://code.google.com/p/compcache/wiki/Performance
This contains data for both positive and negative cases.
Also, it is currently being used on (unofficial) Android builds where
it shows noticeable performance gains compared to plain SSD 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.
>
Adding ramzswap code in place of generic swap slot free notification
is bad since ramzswap is just another module and might not be selected
for compilation. So, the code will include some unnecessary #ifdef'ery.
I think SLOT_FREE notifier is the major worry which is surely too
ramzswap specific (who else would want notification so often).
However, SWAPON and SWAPOFF events are fairly generic and (I hope) should
find some more users in future. If its okay to keep just these two notifiers,
I will replace SWAP_NOTIFY notifier with a simple callback function in
swap_info_struct. In future, if this event finds more users, I will revert
back to this generic notifier.
> The main use for notifiers would be if something is a optional
> module, but that's not the case here.
ramzswap is an optional module.
Thanks,
Nitin
next prev parent reply other threads:[~2009-12-28 15:39 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-28 1:19 [PATCH 1/2] [mmotm] Add notifiers for various swap events Nitin Gupta
2009-12-28 1:20 ` [PATCH 2/2] [mmotm] ramzswap: add handlers " Nitin Gupta
2009-12-28 16:26 ` Yin Kangkai
2009-12-29 2:42 ` Nitin Gupta
2009-12-28 6:13 ` [PATCH 1/2] [mmotm] Add notifiers " Pekka Enberg
2009-12-28 10:21 ` Nitin Gupta
2009-12-28 15:02 ` Andi Kleen
2009-12-28 15:37 ` Nitin Gupta [this message]
2009-12-28 17:29 ` Andi Kleen
2009-12-28 18:43 ` Pekka Enberg
2009-12-28 19:23 ` Andi Kleen
2009-12-29 2:41 ` Nitin Gupta
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=4B38D0CF.9000403@vflare.org \
--to=ngupta@vflare.org \
--cc=akpm@linux-foundation.org \
--cc=andi@firstfloor.org \
--cc=hugh.dickins@tiscali.co.uk \
--cc=kamezawa.hiroyu@jp.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=penberg@cs.helsinki.fi \
/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