Re: udevd is killing file write performance.

From: John McCutchan
Date: Thu Feb 23 2006 - 23:39:10 EST


On Thu, Feb 23, 2006 at 04:14:25PM -0800, Andrew Morton wrote:
> John McCutchan <john@xxxxxxxxxxxxxxxxx> wrote:
> >
> > ...
> > >
> > > I have a bad feeling about this one. It'd be nice to have an exact
> > > understanding of the problen source, but if it's just lots of traffic on
> > > ->d_lock we're kinda stuck. I don't expect we'll run off and RCUify
> > > d_parent or turn d_lock into a seq_lock or anything liek that.
> > >
> > > Then again, maybe making d_lock an rwlock _will_ help - if this workload is
> > > also hitting tree_lock (Robin?) and we're not seeing suckiness due to that
> > > then perhaps the rwlock is magically helping.
> > >
> > >
> > > > instead of your hack.
> > >
> > > It's not a terribly bad hack - it's just poor-man's hashing, and it's
> > > reasonably well-suited to the sorts of machines and workloads which we
> > > expect will hit this problem.
> > >
> >
> > If this is as good as it gets, here is a patch (totally untested).
> >
> > ...
> > @@ -538,7 +537,7 @@
> > struct dentry *parent;
> > struct inode *inode;
> >
> > - if (!atomic_read (&inotify_watches))
> > + if (!atomic_read (&dentry->d_sb->s_inotify_watches))
> > return;
> >
>
> What happens here if we're watching a mountpoint - the parent is on a
> different fs?

There are four cases to consider here.

Case 1: parent fs watched and child fs watched
correct results
Case 2: parent fs watched and child fs not watched
We may not deliver an event that should be delivered.
Case 3: parent fs not watched and child fs watched
We take d_lock when we don't need to
Case 4: parent fs not watched and child fs not watched
correct results

Case 2 screws us. We have to take the lock to even look at the parent's
dentry->d_sb->s_inotify_watches. I don't know of a way around this one.

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