From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: Ingo Molnar <mingo@kernel.org>
Cc: linux-kernel@vger.kernel.org,
Peter Zijlstra <peterz@infradead.org>,
Steven Rostedt <rostedt@goodmis.org>,
Will Deacon <will@kernel.org>,
Thomas Gleixner <tglx@linutronix.de>,
"Paul E . McKenney" <paulmck@kernel.org>,
Linus Torvalds <torvalds@linux-foundation.org>,
Matthew Wilcox <willy@infradead.org>
Subject: Re: [PATCH v2 1/7] locking: Introduce local_lock()
Date: Mon, 25 May 2020 13:26:38 +0200 [thread overview]
Message-ID: <20200525112638.5p2ctr5l26uzergb@linutronix.de> (raw)
In-Reply-To: <20200525070139.GB329373@gmail.com>
On 2020-05-25 09:01:39 [+0200], Ingo Molnar wrote:
>
> * Sebastian Andrzej Siewior <bigeasy@linutronix.de> wrote:
>
> > From: Thomas Gleixner <tglx@linutronix.de>
> >
> > To address this PREEMPT_RT introduced the concept of local_locks which are
> > strictly per CPU.
>
> > +++ b/include/linux/locallock_internal.h
> > @@ -0,0 +1,90 @@
> > +/* SPDX-License-Identifier: GPL-2.0 */
> > +#ifndef _LINUX_LOCALLOCK_H
> > +# error "Do not include directly, include linux/locallock.h"
> > +#endif
> > +
> > +#include <linux/percpu-defs.h>
> > +#include <linux/lockdep.h>
> > +
> > +struct local_lock {
> > +#ifdef CONFIG_DEBUG_LOCK_ALLOC
> > + struct lockdep_map dep_map;
> > + struct task_struct *owner;
> > +#endif
> > +};
>
> This this looks very nice to me, there's a minor data structure
> nomenclature related comment I have:
>
> So local locks were supposed to be a look-alike to all the other
> locking constructs we have, spinlock_t in particular. Why isn't there
> a local_lock_t, instead of requiring 'struct local_lock'?
|git grep "struct \<spinlock\>"
and I did convert them spinlock_t and got even asked why
https://lore.kernel.org/driverdev-devel/20190706100253.GA20497@kroah.com/
but yes. I can stick to local_lock_t instead.
> This abbreviation signals that these are 'small' data structures on
> mainline kernels (zero size in fact), but the other advantage is that
> the shorter name would prevent bloating of previously compact
> structure definitions, such as:
>
> > struct squashfs_stream {
> > - void *stream;
> > + void *stream;
> > + struct local_lock lock;
> > };
>
> This would become:
>
> > struct squashfs_stream {
> > void *stream;
> > + locallock_t lock;
> > };
Wasn't aware as this is considered bloating.
> ( The other departure from spinlocks is that the 'spinlock_t' name,
> without underscores, while making the API names such as spin_lock()
> with an underscore, was a conscious didactic choice. Applying that
> principle to local locks gives us the spinlock_t-equivalent name of
> 'locallock_t' - but the double 'l' reads a bit weirdly in this
> context. So I think using 'local_lock_t' as the data structure is
> probably the better approach. )
Okay, okay, I'm all yours.
> Thanks,
>
> Ingo
Sebastian
next prev parent reply other threads:[~2020-05-25 11:26 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-24 21:57 [PATCH 0/7 v2] " Sebastian Andrzej Siewior
2020-05-24 21:57 ` [PATCH v2 1/7] locking: " Sebastian Andrzej Siewior
2020-05-25 7:01 ` Ingo Molnar
2020-05-25 7:12 ` Ingo Molnar
2020-05-25 11:27 ` Sebastian Andrzej Siewior
2020-05-25 11:26 ` Sebastian Andrzej Siewior [this message]
2020-05-24 21:57 ` [PATCH v2 2/7] radix-tree: Use local_lock for protection Sebastian Andrzej Siewior
2020-05-25 6:29 ` Ingo Molnar
2020-05-25 11:11 ` Matthew Wilcox
2020-05-25 13:26 ` Ingo Molnar
2020-05-25 11:17 ` Sebastian Andrzej Siewior
2020-05-24 21:57 ` [PATCH v2 3/7] mm/swap: " Sebastian Andrzej Siewior
2020-05-25 6:44 ` Ingo Molnar
2020-05-25 17:07 ` Sebastian Andrzej Siewior
2020-05-24 21:57 ` [PATCH v2 4/7] squashfs: make use of local lock in multi_cpu decompressor Sebastian Andrzej Siewior
2020-05-24 21:57 ` [PATCH v2 5/7] connector/cn_proc: Protect send_msg() with a local lock Sebastian Andrzej Siewior
2020-05-25 7:18 ` Ingo Molnar
2020-05-25 14:51 ` Sebastian Andrzej Siewior
2020-05-24 21:57 ` [PATCH v2 6/7] zram: Allocate struct zcomp_strm as per-CPU memory Sebastian Andrzej Siewior
2020-05-25 7:24 ` Ingo Molnar
2020-05-25 16:50 ` Sebastian Andrzej Siewior
2020-05-24 21:57 ` [PATCH v2 7/7] zram: Use local lock to protect per-CPU data Sebastian Andrzej Siewior
2020-05-25 7:26 ` Ingo Molnar
2020-05-25 16:51 ` Sebastian Andrzej Siewior
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=20200525112638.5p2ctr5l26uzergb@linutronix.de \
--to=bigeasy@linutronix.de \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=paulmck@kernel.org \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
--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
all inboxes | Powered by JetHome®