From: Waiman Long <longman@redhat.com>
To: "Thomas Weißschuh" <linux@weissschuh.net>,
"Peter Zijlstra" <peterz@infradead.org>,
"Ingo Molnar" <mingo@redhat.com>, "Will Deacon" <will@kernel.org>,
"Boqun Feng" <boqun.feng@gmail.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] locking/osq: remove spin node definition from header
Date: Tue, 10 Oct 2023 19:07:05 -0400 [thread overview]
Message-ID: <535dd61c-8e3e-103c-e970-2c8514af5596@redhat.com> (raw)
In-Reply-To: <20231010-osq-header-v1-1-d68fbc1bf1cf@weissschuh.net>
On 10/10/23 05:53, Thomas Weißschuh wrote:
> This structure is an implementation detail of osq_lock.c, and there are
> no external users.
>
> Also drop the redundant overview comment from osq_lock.c.
>
> Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
> ---
> include/linux/osq_lock.h | 5 -----
> kernel/locking/osq_lock.c | 9 ++++++---
> 2 files changed, 6 insertions(+), 8 deletions(-)
>
> diff --git a/include/linux/osq_lock.h b/include/linux/osq_lock.h
> index 5581dbd3bd34..ea8fb31379e3 100644
> --- a/include/linux/osq_lock.h
> +++ b/include/linux/osq_lock.h
> @@ -6,11 +6,6 @@
> * An MCS like lock especially tailored for optimistic spinning for sleeping
> * lock implementations (mutex, rwsem, etc).
> */
> -struct optimistic_spin_node {
> - struct optimistic_spin_node *next, *prev;
> - int locked; /* 1 if lock acquired */
> - int cpu; /* encoded CPU # + 1 value */
> -};
It is probably better to drop the MCS like lock comment here as it is
not relevant without the optimistic_spin_node struct.
>
> struct optimistic_spin_queue {
> /*
> diff --git a/kernel/locking/osq_lock.c b/kernel/locking/osq_lock.c
> index d5610ad52b92..918866edbc30 100644
> --- a/kernel/locking/osq_lock.c
> +++ b/kernel/locking/osq_lock.c
> @@ -3,10 +3,13 @@
> #include <linux/sched.h>
> #include <linux/osq_lock.h>
>
> +struct optimistic_spin_node {
> + struct optimistic_spin_node *next, *prev;
> + int locked; /* 1 if lock acquired */
> + int cpu; /* encoded CPU # + 1 value */
> +};
> +
> /*
> - * An MCS like lock especially tailored for optimistic spinning for sleeping
> - * lock implementations (mutex, rwsem, etc).
> - *
> * Using a single mcs node per CPU is safe because sleeping locks should not be
> * called from interrupt context and we have preemption disabled while
> * spinning.
We should keep the MCS comment here. My other suggestion is to put the
structure definition after the comment.
Other than these minor nits, it is a worthwhile cleanup patch.
Cheers,
Longman
prev parent reply other threads:[~2023-10-10 23:08 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-10 9:53 Thomas Weißschuh
2023-10-10 23:07 ` Waiman Long [this message]
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=535dd61c-8e3e-103c-e970-2c8514af5596@redhat.com \
--to=longman@redhat.com \
--cc=boqun.feng@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@weissschuh.net \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=will@kernel.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®