* Re: [PATCH net-next] once: add DO_ONCE_SLOW() for sleepable contexts [not found] <20221001205102.2319658-1-eric.dumazet@gmail.com> @ 2026-01-07 20:59 ` Luck, Tony 2026-01-07 21:17 ` Eric Dumazet 0 siblings, 1 reply; 3+ messages in thread From: Luck, Tony @ 2026-01-07 20:59 UTC (permalink / raw) To: Eric Dumazet Cc: David S . Miller, Jakub Kicinski, Paolo Abeni, netdev, Eric Dumazet, Christophe Leroy, Willy Tarreau, Reinette Chatre 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. ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net-next] once: add DO_ONCE_SLOW() for sleepable contexts 2026-01-07 20:59 ` [PATCH net-next] once: add DO_ONCE_SLOW() for sleepable contexts Luck, Tony @ 2026-01-07 21:17 ` Eric Dumazet 2026-01-07 22:34 ` Luck, Tony 0 siblings, 1 reply; 3+ messages in thread From: Eric Dumazet @ 2026-01-07 21:17 UTC (permalink / raw) To: Luck, Tony Cc: Eric Dumazet, David S . Miller, Jakub Kicinski, Paolo Abeni, netdev, Christophe Leroy, Willy Tarreau, Reinette Chatre 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... Why would you care ? ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net-next] once: add DO_ONCE_SLOW() for sleepable contexts 2026-01-07 21:17 ` Eric Dumazet @ 2026-01-07 22:34 ` Luck, Tony 0 siblings, 0 replies; 3+ messages in thread From: Luck, Tony @ 2026-01-07 22:34 UTC (permalink / raw) To: Eric Dumazet Cc: Eric Dumazet, David S . Miller, Jakub Kicinski, Paolo Abeni, netdev, Christophe Leroy, Willy Tarreau, Reinette Chatre 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 ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-01-07 22:34 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20221001205102.2319658-1-eric.dumazet@gmail.com>
2026-01-07 20:59 ` [PATCH net-next] once: add DO_ONCE_SLOW() for sleepable contexts Luck, Tony
2026-01-07 21:17 ` Eric Dumazet
2026-01-07 22:34 ` Luck, Tony
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox