From: Dave Chinner <david@fromorbit.com>
To: Matthew Wilcox <willy@infradead.org>
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
peterz@infradead.org, mingo@redhat.com, will@kernel.org,
longman@redhat.com, boqun.feng@gmail.com, tglx@linutronix.de,
bigeasy@linutronix.de, hch@infradead.org, npiggin@kernel.dk
Subject: Re: bl_list and lockdep
Date: Wed, 7 Apr 2021 07:22:53 +1000 [thread overview]
Message-ID: <20210406212253.GC1990290@dread.disaster.area> (raw)
In-Reply-To: <20210406132834.GP2531743@casper.infradead.org>
On Tue, Apr 06, 2021 at 02:28:34PM +0100, Matthew Wilcox wrote:
> On Tue, Apr 06, 2021 at 10:33:43PM +1000, Dave Chinner wrote:
> > +++ b/fs/inode.c
> > @@ -57,8 +57,7 @@
> >
> > static unsigned int i_hash_mask __read_mostly;
> > static unsigned int i_hash_shift __read_mostly;
> > -static struct hlist_head *inode_hashtable __read_mostly;
> > -static __cacheline_aligned_in_smp DEFINE_SPINLOCK(inode_hash_lock);
> > +static struct hlist_bl_head *inode_hashtable __read_mostly;
>
> I'm a little concerned that we're losing a lockdep map here.
>
> Nobody seems to have done this for list_bl yet, and I'd be reluctant
> to gate your patch on "Hey, Dave, solve this problem nobody else has
> done yet".
I really don't care about lockdep. Adding lockdep support to
hlist_bl is somebody else's problem - I'm just using infrastructure
that already exists. Also, the dentry cache usage of hlist_bl is
vastly more complex and so if lockdep coverage was really necessary,
it would have already been done....
And, FWIW, I'm also aware of the problems that RT kernels have with
the use of bit spinlocks and being unable to turn them into sleeping
mutexes by preprocessor magic. I don't care about that either,
because dentry cache...
> But maybe we can figure out how to do this? I think we want one lockdep
> map for the entire hashtable (it's split for performance, not because
> they're logically separate locks). So something like ...
>
> static struct lockdep_map inode_hash_map =
> STATIC_LOCKDEP_MAP_INIT("inode_hash", &inode_hash_map);
>
> and add:
>
> static inline void hlist_bl_lock_map(struct hlist_bl_head *b,
> struct lockdep_map *map)
> {
> bit_spin_lock(0, (unsigned long *)b);
> spin_acquire(map, 0, 0, _RET_IP_);
> }
>
> then use hlist_bl_lock_map() throughout. Would that work?
> Adding lockdep experts for opinions.
Maybe, but it's kinda messy to have to carry the lockdep map around
externally to the structure. Not to mention it won't support holding
multiple hash chains locked at once if that is ever needed (e.g.
rehashing an object with a different hashval)...
Cheers,
Dave.
--
Dave Chinner
david@fromorbit.com
next prev parent reply other threads:[~2021-04-06 21:23 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-06 12:33 [RFC PATCH 0/3] vfs: convert inode cache to hlist-bl Dave Chinner
2021-04-06 12:33 ` [PATCH 1/3] vfs: factor out inode hash head calculation Dave Chinner
2021-04-06 22:06 ` Kent Overstreet
2021-04-06 12:33 ` [PATCH 2/3] hlist-bl: add hlist_bl_fake() Dave Chinner
2021-04-06 22:07 ` Kent Overstreet
2021-04-06 12:33 ` [PATCH 3/3] vfs: inode cache conversion to hash-bl Dave Chinner
2021-04-06 13:28 ` bl_list and lockdep Matthew Wilcox
2021-04-06 21:22 ` Dave Chinner [this message]
2021-04-12 15:20 ` Thomas Gleixner
2021-04-12 22:15 ` Dave Chinner
2021-04-12 23:18 ` Thomas Gleixner
2021-04-13 9:58 ` Dave Chinner
2021-04-13 21:24 ` Thomas Gleixner
2021-04-06 22:16 ` [PATCH 3/3] vfs: inode cache conversion to hash-bl Kent Overstreet
2021-04-06 22:03 ` [RFC PATCH 0/3] vfs: convert inode cache to hlist-bl Kent Overstreet
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=20210406212253.GC1990290@dread.disaster.area \
--to=david@fromorbit.com \
--cc=bigeasy@linutronix.de \
--cc=boqun.feng@gmail.com \
--cc=hch@infradead.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=longman@redhat.com \
--cc=mingo@redhat.com \
--cc=npiggin@kernel.dk \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--cc=will@kernel.org \
--cc=willy@infradead.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox