Message ID | 20241015145350.4077765-2-aleksander.lobakin@intel.com (mailing list archive) |
---|---|
State | Changes Requested |
Delegated to: | BPF |
Headers | show |
Series | idpf: XDP chapter III: core XDP changes (+libeth_xdp) | expand |
On Tue, Oct 15, 2024 at 04:53:33PM +0200, Alexander Lobakin wrote: > Sometimes, there's a need to modify a lot of static keys or modify the > same key multiple times in a loop. In that case, it seems more optimal > to lock cpu_read_lock once and then call _cpuslocked() variants. > The enable/disable functions are already exported, the refcounted > counterparts however are not. Fix that to allow modules to save some > cycles. Hi Olek, can you explain how is this at all related to the patchset that it contains? AFAIK I don't see it being used in later changes? > > Signed-off-by: Alexander Lobakin <aleksander.lobakin@intel.com> > --- > kernel/jump_label.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/kernel/jump_label.c b/kernel/jump_label.c > index 93a822d3c468..1034c0348995 100644 > --- a/kernel/jump_label.c > +++ b/kernel/jump_label.c > @@ -182,6 +182,7 @@ bool static_key_slow_inc_cpuslocked(struct static_key *key) > } > return true; > } > +EXPORT_SYMBOL_GPL(static_key_slow_inc_cpuslocked); > > bool static_key_slow_inc(struct static_key *key) > { > @@ -342,6 +343,7 @@ void static_key_slow_dec_cpuslocked(struct static_key *key) > STATIC_KEY_CHECK_USE(key); > __static_key_slow_dec_cpuslocked(key); > } > +EXPORT_SYMBOL_GPL(static_key_slow_dec_cpuslocked); > > void __static_key_slow_dec_deferred(struct static_key *key, > struct delayed_work *work, > -- > 2.46.2 >
From: Maciej Fijalkowski <maciej.fijalkowski@intel.com> Date: Thu, 17 Oct 2024 13:06:25 +0200 > On Tue, Oct 15, 2024 at 04:53:33PM +0200, Alexander Lobakin wrote: >> Sometimes, there's a need to modify a lot of static keys or modify the >> same key multiple times in a loop. In that case, it seems more optimal >> to lock cpu_read_lock once and then call _cpuslocked() variants. >> The enable/disable functions are already exported, the refcounted >> counterparts however are not. Fix that to allow modules to save some >> cycles. > > Hi Olek, > > can you explain how is this at all related to the patchset that it > contains? AFAIK I don't see it being used in later changes? See libeth/xdp.c in patch #18, it's used to enable XDPSQ sharing static key. > >> >> Signed-off-by: Alexander Lobakin <aleksander.lobakin@intel.com> >> --- >> kernel/jump_label.c | 2 ++ >> 1 file changed, 2 insertions(+) >> >> diff --git a/kernel/jump_label.c b/kernel/jump_label.c >> index 93a822d3c468..1034c0348995 100644 >> --- a/kernel/jump_label.c >> +++ b/kernel/jump_label.c >> @@ -182,6 +182,7 @@ bool static_key_slow_inc_cpuslocked(struct static_key *key) >> } >> return true; >> } >> +EXPORT_SYMBOL_GPL(static_key_slow_inc_cpuslocked); >> >> bool static_key_slow_inc(struct static_key *key) >> { >> @@ -342,6 +343,7 @@ void static_key_slow_dec_cpuslocked(struct static_key *key) >> STATIC_KEY_CHECK_USE(key); >> __static_key_slow_dec_cpuslocked(key); >> } >> +EXPORT_SYMBOL_GPL(static_key_slow_dec_cpuslocked); >> >> void __static_key_slow_dec_deferred(struct static_key *key, >> struct delayed_work *work, >> -- >> 2.46.2 >> Thanks, Olek
On Mon, Oct 21, 2024 at 03:53:40PM +0200, Alexander Lobakin wrote: > From: Maciej Fijalkowski <maciej.fijalkowski@intel.com> > Date: Thu, 17 Oct 2024 13:06:25 +0200 > > > On Tue, Oct 15, 2024 at 04:53:33PM +0200, Alexander Lobakin wrote: > >> Sometimes, there's a need to modify a lot of static keys or modify the > >> same key multiple times in a loop. In that case, it seems more optimal > >> to lock cpu_read_lock once and then call _cpuslocked() variants. > >> The enable/disable functions are already exported, the refcounted > >> counterparts however are not. Fix that to allow modules to save some > >> cycles. > > > > Hi Olek, > > > > can you explain how is this at all related to the patchset that it > > contains? AFAIK I don't see it being used in later changes? > > See libeth/xdp.c in patch #18, it's used to enable XDPSQ sharing static key. I got tricked by define in include/linux/jump_label.h and I was directly grepping for funcs being exported:) Not sure who should ack it though. > > > > >> > >> Signed-off-by: Alexander Lobakin <aleksander.lobakin@intel.com> > >> --- > >> kernel/jump_label.c | 2 ++ > >> 1 file changed, 2 insertions(+) > >> > >> diff --git a/kernel/jump_label.c b/kernel/jump_label.c > >> index 93a822d3c468..1034c0348995 100644 > >> --- a/kernel/jump_label.c > >> +++ b/kernel/jump_label.c > >> @@ -182,6 +182,7 @@ bool static_key_slow_inc_cpuslocked(struct static_key *key) > >> } > >> return true; > >> } > >> +EXPORT_SYMBOL_GPL(static_key_slow_inc_cpuslocked); > >> > >> bool static_key_slow_inc(struct static_key *key) > >> { > >> @@ -342,6 +343,7 @@ void static_key_slow_dec_cpuslocked(struct static_key *key) > >> STATIC_KEY_CHECK_USE(key); > >> __static_key_slow_dec_cpuslocked(key); > >> } > >> +EXPORT_SYMBOL_GPL(static_key_slow_dec_cpuslocked); > >> > >> void __static_key_slow_dec_deferred(struct static_key *key, > >> struct delayed_work *work, > >> -- > >> 2.46.2 > >> > > Thanks, > Olek
diff --git a/kernel/jump_label.c b/kernel/jump_label.c index 93a822d3c468..1034c0348995 100644 --- a/kernel/jump_label.c +++ b/kernel/jump_label.c @@ -182,6 +182,7 @@ bool static_key_slow_inc_cpuslocked(struct static_key *key) } return true; } +EXPORT_SYMBOL_GPL(static_key_slow_inc_cpuslocked); bool static_key_slow_inc(struct static_key *key) { @@ -342,6 +343,7 @@ void static_key_slow_dec_cpuslocked(struct static_key *key) STATIC_KEY_CHECK_USE(key); __static_key_slow_dec_cpuslocked(key); } +EXPORT_SYMBOL_GPL(static_key_slow_dec_cpuslocked); void __static_key_slow_dec_deferred(struct static_key *key, struct delayed_work *work,
Sometimes, there's a need to modify a lot of static keys or modify the same key multiple times in a loop. In that case, it seems more optimal to lock cpu_read_lock once and then call _cpuslocked() variants. The enable/disable functions are already exported, the refcounted counterparts however are not. Fix that to allow modules to save some cycles. Signed-off-by: Alexander Lobakin <aleksander.lobakin@intel.com> --- kernel/jump_label.c | 2 ++ 1 file changed, 2 insertions(+)