From: Al Viro <viro@ZenIV.linux.org.uk>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Mika Westerberg <mika.westerberg@linux.intel.com>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Miklos Szeredi <mszeredi@suse.cz>,
linux-fsdevel <linux-fsdevel@vger.kernel.org>
Subject: Re: fs/dcache.c - BUG: soft lockup - CPU#5 stuck for 22s! [systemd-udevd:1667]
Date: Thu, 29 May 2014 17:23:07 +0100 [thread overview]
Message-ID: <20140529162307.GL18016@ZenIV.linux.org.uk> (raw)
In-Reply-To: <20140529154454.GK18016@ZenIV.linux.org.uk>
On Thu, May 29, 2014 at 04:44:54PM +0100, Al Viro wrote:
> On Thu, May 29, 2014 at 08:10:57AM -0700, Linus Torvalds wrote:
> > If so, though, that brings up two questions:
> >
> > (a) do we really want to be that aggressive? Can we ever traverse
> > _past_ the point we're actually trying to shrink in
> > shrink_dcache_parent()?
>
> Caller of shrink_dcache_parent() would better hold a reference to the
> argument, or it might get freed right under us ;-) So no, we can't
> go past that point - the subtree root will stay busy.
>
> The reason we want to be aggressive there is to avoid excessive iterations -
> think what happens e.g. if we have a chain of N dentries, with nothing pinning
> them (i.e. the last one has refcount 0, the first - 2, everything else - 1).
> Simply doing dput() would result in O(N^2) vs. O(N)...
>
> > (b) why does the "dput()" (or rather, the dentry_kill()) locking
> > logic have to retain the old trylock case rather than share the parent
> > locking logic?
> >
> > I'm assuming the answer to (b) is that we can't afford to drop the
> > dentry lock in dentry_kill(), but I'd like that answer to the "Why" to
> > be documented somewhere.
>
> We actually might be able to do it that way (rechecking ->d_count after
> lock_parent()), but I would really prefer to leave that until after -final.
> I want to get profiling data from that first - dput() is a much hotter path
> than shrink_dcache_parent() and friends...
FWIW, I've just done more or less edible splitup of stuff past #for-linus -
see #experimental-dentry_kill for that. Again, I really want to get
profiling data to see if that hurts dput() - it takes ->d_lock on parent
before the trylock on ->i_lock and in case of ->d_lock on parent being
held by somebody else it bangs on rename_lock.lock cacheline. I'd expect
that to be non-issue on any loads, but we need something stronger than
my gut feelings...
BTW, lock_parent() might be better off if in contended case it would not
bother with rename_lock and did something like this:
again:
spin_unlock(&dentry->d_lock);
rcu_read_lock();
parent = ACCESS_ONCE(dentry->d_parent);
if (parent != dentry)
spin_lock(&parent->d_lock);
spin_lock(&dentry->d_lock);
if (likely(dentry->d_parent == parent)) {
rcu_read_unlock();
return parent;
}
if (parent)
spin_unlock(&parent->d_lock);
rcu_read_unlock();
goto again;
It's almost certainly not worth bothering with right now, but if dput()
starts using lock_parent(), it might be worth investigating...
next prev parent reply other threads:[~2014-05-29 16:23 UTC|newest]
Thread overview: 58+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-26 9:37 fs/dcache.c - BUG: soft lockup - CPU#5 stuck for 22s! [systemd-udevd:1667] Mika Westerberg
2014-05-26 13:57 ` Al Viro
2014-05-26 14:29 ` Mika Westerberg
2014-05-26 14:29 ` Mika Westerberg
2014-05-26 15:27 ` Al Viro
2014-05-26 16:42 ` Al Viro
2014-05-26 18:17 ` Linus Torvalds
2014-05-26 18:26 ` Al Viro
2014-05-26 20:24 ` Linus Torvalds
2014-05-27 1:40 ` Al Viro
2014-05-27 3:14 ` Al Viro
2014-05-27 4:00 ` Al Viro
2014-05-27 7:04 ` Mika Westerberg
2014-05-27 7:04 ` Mika Westerberg
2014-05-28 3:19 ` Al Viro
2014-05-28 7:37 ` Mika Westerberg
2014-05-28 11:57 ` Al Viro
2014-05-28 13:11 ` Mika Westerberg
2014-05-28 14:19 ` Al Viro
2014-05-28 18:39 ` Al Viro
2014-05-28 19:43 ` Linus Torvalds
2014-05-28 20:02 ` Linus Torvalds
2014-05-28 20:25 ` Al Viro
2014-05-29 10:42 ` Mika Westerberg
2014-05-28 20:14 ` Al Viro
2014-05-28 21:11 ` Linus Torvalds
2014-05-28 21:28 ` Al Viro
2014-05-29 3:11 ` Al Viro
2014-05-29 3:52 ` Al Viro
2014-05-29 5:34 ` Al Viro
2014-05-29 10:51 ` Mika Westerberg
2014-05-29 10:51 ` Mika Westerberg
2014-05-29 11:04 ` Mika Westerberg
2014-05-29 13:30 ` Al Viro
2014-05-29 14:56 ` Mika Westerberg
2014-05-29 15:10 ` Linus Torvalds
2014-05-29 15:44 ` Al Viro
2014-05-29 16:23 ` Al Viro [this message]
2014-05-29 16:29 ` Linus Torvalds
2014-05-29 16:53 ` Al Viro
2014-05-29 18:52 ` Al Viro
2014-05-29 19:14 ` Linus Torvalds
2014-05-30 4:50 ` Al Viro
2014-05-30 5:00 ` Linus Torvalds
2014-05-30 6:49 ` Al Viro
2014-05-30 8:12 ` Mika Westerberg
2014-05-30 15:21 ` Al Viro
2014-05-30 15:31 ` Linus Torvalds
2014-05-30 16:48 ` [git pull] " Al Viro
2014-05-30 17:14 ` Al Viro
2014-05-31 14:18 ` Josh Boyer
2014-05-31 14:48 ` Linus Torvalds
2014-05-31 14:58 ` Josh Boyer
2014-05-31 16:12 ` Josh Boyer
2014-05-30 17:15 ` Sedat Dilek
2014-05-29 4:21 ` Linus Torvalds
2014-05-29 5:16 ` Al Viro
2014-05-29 5:26 ` Al Viro
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=20140529162307.GL18016@ZenIV.linux.org.uk \
--to=viro@zeniv.linux.org.uk \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mika.westerberg@linux.intel.com \
--cc=mszeredi@suse.cz \
--cc=torvalds@linux-foundation.org \
/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.