public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* 2.6.10-mm3 scaling problem with inotify
@ 2005-01-13 23:56 John Hawkes
  2005-01-14  0:49 ` Robert Love
  0 siblings, 1 reply; 11+ messages in thread
From: John Hawkes @ 2005-01-13 23:56 UTC (permalink / raw)
  To: linux-kernel, rml

I believe I've encountered a scaling problem with the inotify code in
2.6.10-mm3.

vfs_read() and vfs_write() (for example) do:
    dnotify_parent(dentry, DN_ACCESS);
    inotify_dentry_parent_queue_event(dentry,
                           IN_ACCESS, 0, dentry->d_name.name);
    inotify_inode_queue_event(inode, IN_ACCESS, 0, NULL);
for the optional "notify" functionality.

dnotify_parent() knows how to exit quickly:
       if (!dir_notify_enable)
                return;
looking at a global flag, and inotify_inode_queue_event() also knows a quick
exit:
        if (!inode->inotify_data)
                return;
However, inotify_dentry_parent_queue_event() first has to get the parent 
dentry:
        parent = dget_parent(dentry);
        inotify_inode_queue_event(parent->d_inode, mask, cookie, filename);
        dput(parent);
and, sadly, dget_parent(dentry) grabs a spinlock (dentry->d_lock) and dirties a cacheline (dentry->dcount).  I have an AIM7-like workload that does numerous
concurrent reads and suffers a 40% drop in performance because of this,
primarily due to spinlock contention.

Is it possible for a parent's inode->inotify_data to be enabled when none of 
its children's inotify_data are enabled?  That would make it easy - just look 
at the current inode's inotify_data before walking back to the parent.

John Hawkes

^ permalink raw reply	[flat|nested] 11+ messages in thread
* 2.6.10-mm3 scaling problem with inotify
@ 2005-01-14  0:51 John Hawkes
  0 siblings, 0 replies; 11+ messages in thread
From: John Hawkes @ 2005-01-14  0:51 UTC (permalink / raw)
  To: linux-kernel, rml

I believe I've encountered a scaling problem with the inotify code in
2.6.10-mm3.

vfs_read() and vfs_write() (for example) do:
    dnotify_parent(dentry, DN_ACCESS);
    inotify_dentry_parent_queue_event(dentry,
                           IN_ACCESS, 0, dentry->d_name.name);
    inotify_inode_queue_event(inode, IN_ACCESS, 0, NULL);
for the optional "notify" functionality.

dnotify_parent() knows how to exit quickly:
       if (!dir_notify_enable)
                return;
looking at a global flag, and inotify_inode_queue_event() also knows a quick
exit:
        if (!inode->inotify_data)
                return;
However, inotify_dentry_parent_queue_event() first has to get the parent 
dentry:
        parent = dget_parent(dentry);
        inotify_inode_queue_event(parent->d_inode, mask, cookie, filename);
        dput(parent);
and, sadly, dget_parent(dentry) grabs a spinlock (dentry->d_lock) and dirties a cacheline (dentry->dcount).  I have an AIM7-like workload that does numerous
concurrent reads and suffers a 40% drop in performance because of this.

Is it possible for a parent's inode->inotify_data to be enabled when none of 
its children's inotify_data are enabled?  That would make it easy - just look 
at the current inode's inotify_data before walking back to the parent.

John Hawkes

^ permalink raw reply	[flat|nested] 11+ messages in thread
* RE: 2.6.10-mm3 scaling problem with inotify
@ 2005-01-14  2:31 Zou, Nanhai
  2005-01-14  2:36 ` John McCutchan
  2005-01-14  2:41 ` Robert Love
  0 siblings, 2 replies; 11+ messages in thread
From: Zou, Nanhai @ 2005-01-14  2:31 UTC (permalink / raw)
  To: John McCutchan; +Cc: linux-kernel, rml, hawkes

> -----Original Message-----
> From: Zou, Nanhai
> Sent: Friday, January 14, 2005 10:28 AM
> To: 'John McCutchan'
> Subject: RE: 2.6.10-mm3 scaling problem with inotify
> 
> > From: linux-kernel-owner@vger.kernel.org
> > [mailto:linux-kernel-owner@vger.kernel.org] On Behalf Of John
McCutchan
> > Sent: Friday, January 14, 2005 9:31 AM
> > To: Robert Love
> > Cc: John Hawkes; linux-kernel@vger.kernel.org
> > Subject: Re: 2.6.10-mm3 scaling problem with inotify
> >
> > On Thu, 2005-01-13 at 19:49 -0500, Robert Love wrote:
> > > On Thu, 2005-01-13 at 15:56 -0800, John Hawkes wrote:
> > > [snip]
> > >
> > > I am open to other ideas, too, but I don't see any nice shortcuts
like
> > > what we can do in inotify_inode_queue_event().
> > >
> > > (Other) John?  Any ideas?
> >
> > No, you covered things well. This code was really just a straight
copy
> > of the dnotify code. Rob cleaned it up at some point, giving us what
we
> > have today. The only fix I can think of is the one suggested by Rob
--
> > copying the dnotify code again.

 
 There is still a little difference between your implement in
 inotify_dentry_parent_queue_event from dnotify_parent
 
 In dnotify_parent, if parent is not watching the event, the code will
not fall
 through dget and dput path.
 
 While in inotify_dentry_parent_queue_event kernel will go dget and dput
even
 if (inode->inotify_data == NULL).
 
 While dget and dput will introduce a lot of atomic operations..
 And the most important, dput will grab global dcache_lock...,
 I think that is the reason why John Hawkes saw great performance drop.
 
 Simply follow dnotify_parent, only call dget and dput when
inode->inotify_data != NULL will solve this problem I think.


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2005-01-14 18:40 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-01-13 23:56 2.6.10-mm3 scaling problem with inotify John Hawkes
2005-01-14  0:49 ` Robert Love
2005-01-14  1:31   ` John McCutchan
2005-01-14  2:29     ` Robert Love
2005-01-14 18:05       ` John Hawkes
2005-01-14 18:15         ` Robert Love
2005-01-14 18:39           ` John Hawkes
  -- strict thread matches above, loose matches on Subject: below --
2005-01-14  0:51 John Hawkes
2005-01-14  2:31 Zou, Nanhai
2005-01-14  2:36 ` John McCutchan
2005-01-14  2:41 ` Robert Love

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox