All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Paris <eparis@redhat.com>
To: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: linux-kernel@vger.kernel.org, malware-list@lists.printk.net,
	viro@zeniv.linux.org.uk, akpm@linux-foundation.org,
	alan@lxorguk.ukuu.org.uk, arjan@infradead.org, hch@infradead.org
Subject: Re: [PATCH -v3 6/8] fsnotify: add group priorities
Date: Mon, 01 Dec 2008 10:20:57 -0500	[thread overview]
Message-ID: <1228144857.11752.32.camel@localhost.localdomain> (raw)
In-Reply-To: <1227803109.4454.1773.camel@twins>

On Thu, 2008-11-27 at 17:25 +0100, Peter Zijlstra wrote:
> On Tue, 2008-11-25 at 12:21 -0500, Eric Paris wrote:
> > In preperation for blocking fsnotify calls group priorities must be added.
> > When multiple groups request the same event type the lowest priority group
> > will receive the notification first.
> 
> > @@ -114,9 +117,26 @@ struct fsnotify_group *fsnotify_find_group(unsigned int group_num, unsigned long
> >  
> >  	group->ops = ops;
> >  
> > -	/* add it */
> > -	list_add_rcu(&group->group_list, &fsnotify_groups);
> > +	/* Do we need to be the first entry? */
> > +	if (list_empty(&fsnotify_groups)) {
> > +		list_add_rcu(&group->group_list, &fsnotify_groups);
> > +		goto out;
> > +	}
> > +
> > +	list_for_each_entry(group_iter, &fsnotify_groups, group_list) {
> > +		/* insert in front of this one? */
> > +		if (priority < group_iter->priority) {
> > +			/* I used list_add_tail() to insert in front of group_iter...  */
> > +			list_add_tail_rcu(&group->group_list, &group_iter->group_list);
> > +			break;
> > +		}
> >  
> > +		/* are we at the end?  if so insert at end */
> > +		if (list_is_last(&group_iter->group_list, &fsnotify_groups)) {
> > +			list_add_tail_rcu(&group->group_list, &fsnotify_groups);
> > +			break;
> > +		}
> > +	}
> >  out:
> >  	mutex_unlock(&fsnotify_grp_mutex);
> >  	fsnotify_recalc_global_mask();
> 
> What priority range do you need to cater for, and how many groups? 

On a typical system I'd expect to see one group for dnotify (rpmidmapd
uses dnotify so most systems will end up having 1 group I would expect)

inotify I wouldn't expect more than 3-4 inotify_init() calls

fsnotify I wouldn't imagine more than 3 groups.

So total we are talking about maybe 10 groups on a system really making
use of fs notification?

> I can
> imagine for many groups and limit range a priority list might be better
> suited.

talking about plist.h?  Since I don't allow 2 groups with the same
priority I'd say a lot of the plist code would just be overhead (the
prio list and the node list would be the same)

That's not a big deal since I don't really care about the add/remove
code paths since they are all notification overhead/setup/teardown.  I
would think that cleaner simpler code would probably be a better idea
rather than performance for these areas especially since it looks like
the speed critical parts of plists (list_for_each_entry) would be the
exact same.

what I don't see is plists being protected by RCU and looking at
plist_del it doesn't seem like it would be rcu safe.  RCU safe plists
might be a good idea, but for now I think I should just do my own
priority listing so I don't have to hold a lock while I walk the group
list (that path is VERY hot)

-Eric


  reply	other threads:[~2008-12-01 15:22 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-25 17:20 [PATCH -v3 0/8] file notification: fsnotify a unified file notification backend Eric Paris
2008-11-25 17:20 ` [PATCH -v3 1/8] filesystem notification: create fs/notify to contain all fs notification Eric Paris
2008-11-28  5:24   ` Al Viro
2008-11-25 17:21 ` [PATCH -v3 2/8] fsnotify: pass a file instead of an inode to open, read, and write Eric Paris
2008-11-25 17:21 ` [PATCH -v3 3/8] fsnotify: sys_execve and sys_uselib do not call into fsnotify Eric Paris
2008-11-28 10:16   ` Christoph Hellwig
2008-11-25 17:21 ` [PATCH -v3 4/8] fsnotify: use the new open-exec hook for inotify and dnotify Eric Paris
2008-11-25 17:21 ` [PATCH -v3 5/8] fsnotify: unified filesystem notification backend Eric Paris
2008-11-27 16:14   ` Peter Zijlstra
2008-11-27 16:17   ` Peter Zijlstra
2008-11-27 16:20   ` Peter Zijlstra
2008-11-28 23:22     ` Eric Paris
2008-11-28 23:39       ` Peter Zijlstra
2008-11-27 16:21   ` Peter Zijlstra
2008-11-28  4:54   ` Al Viro
2008-11-28 23:32     ` Eric Paris
2008-11-25 17:21 ` [PATCH -v3 6/8] fsnotify: add group priorities Eric Paris
2008-11-27 16:25   ` Peter Zijlstra
2008-12-01 15:20     ` Eric Paris [this message]
2008-12-01 15:37       ` Peter Zijlstra
2008-11-25 17:21 ` [PATCH -v3 7/8] fsnotify: add in inode fsnotify markings Eric Paris
2008-11-27 16:29   ` Peter Zijlstra
2008-11-28  5:42   ` Al Viro
2008-11-28 23:43     ` Eric Paris
2008-11-25 17:21 ` [PATCH -v3 8/8] dnotify: reimplement dnotify using fsnotify Eric Paris
2008-11-28  5:14   ` Al Viro
2008-11-28 23:37     ` Eric Paris
2008-11-28  6:25   ` Al Viro
2008-11-28 23:44     ` Eric Paris
2008-11-26  0:14 ` [PATCH -v3 0/8] file notification: fsnotify a unified file notification backend Andrew Morton
2008-11-26  2:00   ` Eric Paris

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=1228144857.11752.32.camel@localhost.localdomain \
    --to=eparis@redhat.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=akpm@linux-foundation.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=arjan@infradead.org \
    --cc=hch@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=malware-list@lists.printk.net \
    --cc=viro@zeniv.linux.org.uk \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.