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, 14 Jan 2010 15:10:14 +0000 (GMT)
From:	Hugh Dickins <hugh.dickins@...cali.co.uk>
To:	Nitin Gupta <ngupta@...are.org>
cc:	Pekka Enberg <penberg@...helsinki.fi>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Al Viro <viro@...IV.linux.org.uk>,
	Christoph Hellwig <hch@...radead.org>,
	Jens Axboe <jens.axboe@...cle.com>,
	Andi Kleen <andi@...stfloor.org>,
	linux-kernel <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] [mmotm] comment on swap notify locking constraints

On Thu, 14 Jan 2010, Nitin Gupta wrote:

> A block device makes swap_slot_free_notify() callback
> when the last reference to a swap slot is dropped.
> 
> This callback is made under swap_lock and often with
> lock for corresponding swapcache page also held. This
> is a note of warning for registered callback function
> which must meet these constraints.

You're right that the page lock of the corresponding swapcache page
may be held there, but that isn't what worried me enough to ask for
a comment: it's the page table lock (sometimes we call it pte lock),
a spinlock like the swap_lock, being held there that particularly
deserves comment.  We don't want someone going to lots of effort
to avoid holding swap_lock there, only to find that effort wasted
because page table lock is also held.

Hugh

> 
> Signed-off-by: Nitin Gupta <ngupta@...are.org>
> ---
>  include/linux/blkdev.h |    1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
> 
> diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
> index 14b95a3..e3dcff6 100644
> --- a/include/linux/blkdev.h
> +++ b/include/linux/blkdev.h
> @@ -1295,6 +1295,7 @@ struct block_device_operations {
>  						unsigned long long);
>  	int (*revalidate_disk) (struct gendisk *);
>  	int (*getgeo)(struct block_device *, struct hd_geometry *);
> +	/* this callback is with swap_lock and often page lock also held */

                                                     and page table lock

>  	void (*swap_slot_free_notify) (struct block_device *, unsigned long);
>  	struct module *owner;
>  };
> -- 
> 1.6.2.5
--
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