From: Waiman Long <longman@redhat.com>
To: Bongkyu Kim <bongkyu7.kim@samsung.com>,
peterz@infradead.org, mingo@redhat.com, will@kernel.org,
boqun.feng@gmail.com
Cc: linux-kernel@vger.kernel.org, gregkh@linuxfoundation.org,
kernel test robot <lkp@intel.com>
Subject: Re: [PATCH v1 2/2] locking/rwsem: Make reader optimistic spinning optional
Date: Thu, 31 Aug 2023 11:22:50 -0400 [thread overview]
Message-ID: <ffb21fd4-e227-1209-666f-12a31ae1c9b6@redhat.com> (raw)
In-Reply-To: <20230831030004.16576-3-bongkyu7.kim@samsung.com>
On 8/30/23 23:00, Bongkyu Kim wrote:
> Disable reader optimistic spinning by default. And, can enable it
> by "rwsem.opt_rspin" cmdline.
>
> Also, fix compile error without CONFIG_RWSEM_SPIN_ON_OWNER (reported by
> kernel test robot)
>
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202306010043.VJHcuCnb-lkp@intel.com/
> Signed-off-by: Bongkyu Kim <bongkyu7.kim@samsung.com>
> ---
> .../admin-guide/kernel-parameters.txt | 9 +++++++++
> kernel/locking/rwsem.c | 18 +++++++++++++++++-
> 2 files changed, 26 insertions(+), 1 deletion(-)
>
> diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
> index 772b54df084b..adf16a07fe4d 100644
> --- a/Documentation/admin-guide/kernel-parameters.txt
> +++ b/Documentation/admin-guide/kernel-parameters.txt
> @@ -5605,6 +5605,15 @@
>
> rw [KNL] Mount root device read-write on boot
>
> + rwsem.opt_rspin [KNL]
> + Use rwsem reader optimistic spinning. Reader optimistic
> + spinning is helpful when the reader critical section is
> + short and there aren't that many readers around.
> + For example, enable this option may improve performance
> + in mobile workload that there're not many readers, but
> + may reduce performance in server workload that there're
> + many readers.
> +
> S [KNL] Run init in single mode
>
> s390_iommu= [HW,S390]
> diff --git a/kernel/locking/rwsem.c b/kernel/locking/rwsem.c
> index 9c0462d515c1..de3f173d94d4 100644
> --- a/kernel/locking/rwsem.c
> +++ b/kernel/locking/rwsem.c
> @@ -117,6 +117,19 @@
> # define DEBUG_RWSEMS_WARN_ON(c, sem)
> #endif
>
> +#ifdef CONFIG_RWSEM_SPIN_ON_OWNER
> +static bool rwsem_opt_rspin;
You need to move this definition out of the "ifdef
CONFIG_RWSEM_SPIN_ON_OWNER" block or a compilation error in
rwsem_down_read_slowpath() may happen if CONFIG_RWSEM_SPIN_ON_OWNER
isn't defined. You may also add __ro_after_init to rwsem_opt_rspin.
Cheers,
Longman
> +
> +static int __init opt_rspin(char *str)
> +{
> + rwsem_opt_rspin = true;
> +
> + return 0;
> +}
> +
> +early_param("rwsem.opt_rspin", opt_rspin);
> +#endif
> +
> /*
> * On 64-bit architectures, the bit definitions of the count are:
> *
> @@ -1083,7 +1096,7 @@ static inline bool rwsem_reader_phase_trylock(struct rw_semaphore *sem,
> return false;
> }
>
> -static inline bool rwsem_no_spinners(sem)
> +static inline bool rwsem_no_spinners(struct rw_semaphore *sem)
> {
> return false;
> }
> @@ -1157,6 +1170,9 @@ rwsem_down_read_slowpath(struct rw_semaphore *sem, long count, unsigned int stat
> return sem;
> }
>
> + if (!IS_ENABLED(CONFIG_RWSEM_SPIN_ON_OWNER) || !rwsem_opt_rspin)
> + goto queue;
> +
> /*
> * Save the current read-owner of rwsem, if available, and the
> * reader nonspinnable bit.
prev parent reply other threads:[~2023-08-31 15:24 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20230831030048epcas2p4de6faba4d56212b06939421feb0bc56d@epcas2p4.samsung.com>
2023-08-31 3:00 ` [PATCH v1 0/2] " Bongkyu Kim
[not found] ` <CGME20230831030055epcas2p22e256228eea85fa3f04aa7d2e8d0bcfa@epcas2p2.samsung.com>
2023-08-31 3:00 ` [PATCH v1 1/2] Revert "locking/rwsem: Remove reader optimistic spinning" Bongkyu Kim
[not found] ` <CGME20230831030057epcas2p3031d3497e47e61182a5b593c2d8e5dd6@epcas2p3.samsung.com>
2023-08-31 3:00 ` [PATCH v1 2/2] locking/rwsem: Make reader optimistic spinning optional Bongkyu Kim
2023-08-31 15:22 ` 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=ffb21fd4-e227-1209-666f-12a31ae1c9b6@redhat.com \
--to=longman@redhat.com \
--cc=bongkyu7.kim@samsung.com \
--cc=boqun.feng@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lkp@intel.com \
--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®