All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Luck, Tony" <tony.luck@intel.com>
To: Eric Dumazet <edumazet@google.com>
Cc: Eric Dumazet <eric.dumazet@gmail.com>,
	"David S . Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	netdev <netdev@vger.kernel.org>,
	Christophe Leroy <christophe.leroy@csgroup.eu>,
	Willy Tarreau <w@1wt.eu>,
	Reinette Chatre <reinette.chatre@intel.com>
Subject: Re: [PATCH net-next] once: add DO_ONCE_SLOW() for sleepable contexts
Date: Wed, 7 Jan 2026 14:34:06 -0800	[thread overview]
Message-ID: <aV7fXuvIMNOP0Kp8@agluck-desk3> (raw)
In-Reply-To: <CANn89iK72b5bSjq0MeedXJ5Onk22Pnw6cjNr0cAYP_-hv8RhAQ@mail.gmail.com>

On Wed, Jan 07, 2026 at 10:17:52PM +0100, Eric Dumazet wrote:
> On Wed, Jan 7, 2026 at 9:59 PM Luck, Tony <tony.luck@intel.com> wrote:
> >
> > On Sat, Oct 01, 2022 at 01:51:02PM -0700, Eric Dumazet wrote:
> > > +void __do_once_slow_done(bool *done, struct static_key_true *once_key,
> > > +                      struct module *mod)
> > > +     __releases(once_mutex)
> > > +{
> > > +     *done = true;
> > > +     mutex_unlock(&once_mutex);
> > > +     once_disable_jump(once_key, mod);
> >
> > This seems to have been cut & pasted from __do_once_done(). But is there
> > a reason for the "sleepable" version to defer resetting the static key
> > in a work queue? Can't we just inline do:
> >
> >         BUG_ON(!static_key_enabled(once_key));
> >         static_branch_disable(once_key);
> >
> > > +}
> >
> > -Tony
> >
> > Credit to Reinette for raising this question. Blame me if I didn't spot
> > why a work queue is needed.
> 
> Note this is used from one single place, one time...

Boris pointed me to <linux/once.h> when reviewing a patch with open-coded
"do this once" section. So there may be about to be a second user. Perhaps
more to follow as the DO_ONCE*() macros look to be a very neat, concise,
and obvious way to call a function just once.

> Why would you care ?

It looks like unnecessary overhead, but I wondered if there was
something I was missing. Some reason why the SLEEPABLE version
needed to delay clearing the static key to a work queue.

-Tony

      reply	other threads:[~2026-01-07 22:34 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-01 20:51 [PATCH net-next] once: add DO_ONCE_SLOW() for sleepable contexts Eric Dumazet
2022-10-01 21:15 ` Willy Tarreau
2022-10-01 22:50   ` Jason A. Donenfeld
2022-10-02  5:38     ` Willy Tarreau
2022-10-01 22:44 ` Jason A. Donenfeld
2022-10-01 22:50   ` Eric Dumazet
2022-10-03 17:25   ` Jakub Kicinski
2022-10-03 17:43     ` Jason A. Donenfeld
2022-10-03 18:14       ` [PATCH net-next] once: rename _SLOW to _SLEEPABLE Jason A. Donenfeld
2022-10-03 18:14         ` [PATCH] " Jason A. Donenfeld
2022-10-03 22:50         ` Eric Dumazet
2022-10-02  8:58 ` [PATCH net-next] once: add DO_ONCE_SLOW() for sleepable contexts Christophe Leroy
2022-10-03 12:40 ` patchwork-bot+netdevbpf
2026-01-07 20:59 ` Luck, Tony
2026-01-07 21:17   ` Eric Dumazet
2026-01-07 22:34     ` Luck, Tony [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=aV7fXuvIMNOP0Kp8@agluck-desk3 \
    --to=tony.luck@intel.com \
    --cc=christophe.leroy@csgroup.eu \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=eric.dumazet@gmail.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=reinette.chatre@intel.com \
    --cc=w@1wt.eu \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.