mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Reinette Chatre <reinette.chatre@intel.com>
To: Tony Luck <tony.luck@intel.com>,
	Andrew Morton <akpm@linux-foundation.org>
Cc: Eric Dumazet <edumazet@google.com>,
	<linux-kernel@vger.kernel.org>, <patches@lists.linux.dev>
Subject: Re: [PATCH] once: Don't use a work queue to reset sleepable static key
Date: Thu, 8 Jan 2026 16:33:18 -0800	[thread overview]
Message-ID: <c27ff6a4-505c-4873-9e41-d52a21a1eba8@intel.com> (raw)
In-Reply-To: <20260108232717.14411-1-tony.luck@intel.com>

Hi Tony,

On 1/8/26 3:27 PM, Tony Luck wrote:
> Pointless overhead to use a work queue to reset the static key
> for a DO_ONCE_SLEEPABLE() invocation.
> 
> Reported-by: Reinette Chatre <reinette.chatre@intel.com>
> Signed-off-by: Tony Luck <tony.luck@intel.com>
> ---
>  lib/once.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/once.c b/lib/once.c
> index 2c306f0e891e..d83bdde78ced 100644
> --- a/lib/once.c
> +++ b/lib/once.c
> @@ -93,6 +93,7 @@ void __do_once_sleepable_done(bool *done, struct static_key_true *once_key,
>  {
>  	*done = true;
>  	mutex_unlock(&once_mutex);
> -	once_disable_jump(once_key, mod);
> +	BUG_ON(!static_key_enabled(once_key));
> +	static_branch_disable(once_key);

Can this be simplified more by disabling once_key with once_mutex held to eliminate the need for the
done boolean? Unless static_branch_disable() is considered to be so slow that it should also be
avoided in sleepable context, deferring to a mutex protected boolean until it completes ...
If "done" boolean is removed this may need an additional check of once_key within
__do_once_sleepable_start() just in case a second caller was blocked on once_mutex.

Reinette

  reply	other threads:[~2026-01-09  0:34 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-08 23:27 Tony Luck
2026-01-09  0:33 ` Reinette Chatre [this message]
2026-01-11  2:54 ` Andrew Morton
2026-01-12 18:08 ` [PATCH v2] " Luck, Tony

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=c27ff6a4-505c-4873-9e41-d52a21a1eba8@intel.com \
    --to=reinette.chatre@intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=edumazet@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=patches@lists.linux.dev \
    --cc=tony.luck@intel.com \
    /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®