diff mbox series

[net-next,11/12] jump_label: export static_key_slow_{inc,dec}_cpuslocked()

Message ID 20241211172649.761483-12-aleksander.lobakin@intel.com (mailing list archive)
State New
Delegated to: Netdev Maintainers
Headers show
Series xdp: a fistful of generic changes pt. II | expand

Checks

Context Check Description
netdev/series_format success Posting correctly formatted
netdev/tree_selection success Clearly marked for net-next, async
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers warning 2 maintainers not CCed: ardb@kernel.org rostedt@goodmis.org
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 1 this patch: 1
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 14 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2024-12-12--00-00 (tests: 764)

Commit Message

Alexander Lobakin Dec. 11, 2024, 5:26 p.m. UTC
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(+)

Comments

Josh Poimboeuf Dec. 11, 2024, 5:40 p.m. UTC | #1
On Wed, Dec 11, 2024 at 06:26:48PM +0100, 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.
> 
> 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);

Where's the code which uses this?
diff mbox series

Patch

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,