lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 24 Sep 2009 12:50:00 +0900
From:	KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>
To:	ngupta@...are.org
Cc:	Hugh Dickins <hugh.dickins@...cali.co.uk>,
	Pekka Enberg <penberg@...helsinki.fi>,
	linux-kernel <linux-kernel@...r.kernel.org>,
	linux-mm <linux-mm@...ck.org>
Subject: Re: [PATCH RFC 1/2] Add notifiers for various swap events

On Thu, 24 Sep 2009 08:40:56 +0530
Nitin Gupta <ngupta@...are.org> wrote:

> On 09/24/2009 07:17 AM, KAMEZAWA Hiroyuki wrote:
> > On Mon, 21 Sep 2009 19:03:59 +0530
> > Nitin Gupta <ngupta@...are.org> wrote:
> > 
> >> Add notifiers for following swap 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 (as shown in patch 2/2).
> >>
> >> 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.
> >>
> > Hmm ? if it's not necessary to make ramzswap as module, for-ramzswap-only
> > code is much easier to read..
> >
> 
> The patches posted earlier (v3 patches) inserts special hooks for swap slot
> free event only. In this version, the callback is set when we get first R/W request.
> Actually ramzswap needs callback for swapon/swapoff too but I just didn't do it.
> 
> Then Pekka posted test patch that allows setting this callback during swapon
> itself. Looking that all these patches, I realized its already too messy even
> if we just make everything ramzswap specific.
> Just FYI, Pekka's test patch:
> http://patchwork.kernel.org/patch/48472/
> 
> Then I added this generic notifier interface which, compared to earlier version,
> looks much cleaner. The code to add these notifiers is also very small.
>  
ya, yes. the patch itsels seems clean.

> > 
> > 
> >> For SWAP_EVENT_SLOT_FREE, callbacks are made under swap_lock. Currently, this
> >> is not a problem since ramzswap is the only user and the callback it registers
> >> can be safely made under this lock. However, if this event finds more users,
> >> we might have to work on reducing contention on this lock.
> >>
> >> Signed-off-by: Nitin Gupta <ngupta@...are.org>
> >>
> > 
> > In general, notifier chain codes allowed to return NOTIFY_BAD.
> > But this patch just assumes all chains should return NOTIFY_OK or
> > just ignore return code.
> > 
> > That's not good as generic interface, I think.
> 
> 
> What action we can take here if the notifier_call_chain() returns an error (apart
> from maybe printing an error)? Perhaps we can add a warning in case of swapon/off
> events but not in case of swap slot free event which is called under swap_lock.
> 
If return code is ignored, please add commentary at least.

I wonder I may able to move memcg's swap_cgroup code for swapon/swapoff onto this
notifier. (swap_cgroup_swapon/swap_cgroup_swapoff) But it seems not.
sorry for bothering you.

Thanks,
-Kame


> 
> 
> Thanks,
> Nitin
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ