[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <c6d9bea0812181428s2ae78e30y1e700b2eca07ca96@mail.gmail.com>
Date: Thu, 18 Dec 2008 17:28:56 -0500
From: "C. Scott Ananian" <cscott@...top.org>
To: "Eric Paris" <eparis@...hat.com>
Cc: linux-kernel@...r.kernel.org, a.p.zijlstra@...llo.nl,
viro@...iv.linux.org.uk, hch@...radead.org, zbr@...emap.net,
akpm@...ux-foundation.org, alan@...rguk.ukuu.org.uk
Subject: Re: [RFC PATCH -v4 12/14] fsnotify: add correlations between events
On Fri, Dec 12, 2008 at 4:52 PM, Eric Paris <eparis@...hat.com> wrote:
> inotify sends userspace a correlation between events when they are related
> (aka when dentries are moved). This adds that same support for all
> fsnotify events.
> diff --git a/fs/notify/notification.c b/fs/notify/notification.c
> index 8ed9d32..7243b20 100644
> --- a/fs/notify/notification.c
> +++ b/fs/notify/notification.c
> @@ -34,6 +35,13 @@
>
> static struct kmem_cache *event_kmem_cache;
> static struct kmem_cache *event_holder_kmem_cache;
> +static atomic_t fsnotify_sync_cookie = ATOMIC_INIT(0);
> +
> +u32 fsnotify_get_cookie(void)
> +{
> + return atomic_inc_return(&fsnotify_sync_cookie);
> +}
> +EXPORT_SYMBOL_GPL(fsnotify_get_cookie);
>
> int fsnotify_check_notif_queue(struct fsnotify_group *group)
> {
atomic_inc_return seems rather expensive to put on a hot path in
almost every fs operation. On a multiprocessor system, the cache line
for fsnotify_sync_cookie would be ping-ponging constantly between
processors. The canonical solution is to form the cookie by
concatenating the processor number with a per-processor cookie, so
that generating a new cookie would not require synchronization between
processors. Surely this code already exists to be used somewhere in
Linux.
--scott
--
( http://cscott.net/ )
--
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