diff mbox series

[net-next,1/3] once: use __section(".data.once")

Message ID 20211115172303.3732746-2-eric.dumazet@gmail.com (mailing list archive)
State Accepted
Commit c2c60ea37e5b6be58c9dd7aff0b2e86ba0f18e0b
Delegated to: Netdev Maintainers
Headers show
Series net: better packing of global vars | expand

Checks

Context Check Description
netdev/tree_selection success Clearly marked for net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix success Link
netdev/cover_letter success Series has a cover letter
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 6440 this patch: 6440
netdev/cc_maintainers fail 3 maintainers not CCed: andriy.shevchenko@linux.intel.com wangkefeng.wang@huawei.com akpm@linux-foundation.org
netdev/build_clang success Errors and warnings before: 1175 this patch: 1175
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 6620 this patch: 6620
netdev/checkpatch fail ERROR: do not initialise statics to false
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Eric Dumazet Nov. 15, 2021, 5:23 p.m. UTC
From: Eric Dumazet <edumazet@google.com>

.data.once contains nicely packed bool variables.
It is used already by DO_ONCE_LITE().

Using it also in DO_ONCE() removes holes in .data section.

Signed-off-by: Eric Dumazet <edumazet@google.com>
---
 include/linux/once.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/include/linux/once.h b/include/linux/once.h
index d361fb14ac3a2c5b77c289107f093862194ebd1c..f54523052bbcb5d0c13017d4684b68ceb8da5855 100644
--- a/include/linux/once.h
+++ b/include/linux/once.h
@@ -38,7 +38,7 @@  void __do_once_done(bool *done, struct static_key_true *once_key,
 #define DO_ONCE(func, ...)						     \
 	({								     \
 		bool ___ret = false;					     \
-		static bool ___done = false;				     \
+		static bool __section(".data.once") ___done = false;	     \
 		static DEFINE_STATIC_KEY_TRUE(___once_key);		     \
 		if (static_branch_unlikely(&___once_key)) {		     \
 			unsigned long ___flags;				     \