mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alexander Lobakin <alexandr.lobakin@intel.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Alexander Lobakin <alexandr.lobakin@intel.com>,
	Arnd Bergmann <arnd@arndb.de>,
	Nathan Chancellor <nathan@kernel.org>,
	Nick Desaulniers <ndesaulniers@google.com>,
	Zhen Lei <thunder.leizhen@huawei.com>,
	linux-kernel@vger.kernel.org, llvm@lists.linux.dev
Subject: [PATCH] numa: mark __next_node() as __always_inline to fix section mismatch
Date: Mon,  6 Dec 2021 17:17:45 +0100	[thread overview]
Message-ID: <20211206161745.39028-1-alexandr.lobakin@intel.com> (raw)

Clang (13) uninlines __next_node() which emits the following warning
due to that this function is used in init code (amd_numa_init(),
sched_init_numa() etc.):

WARNING: modpost: vmlinux.o(.text+0x927ee): Section mismatch
in reference from the function __next_node() to the variable
.init.data:numa_nodes_parsed
The function __next_node() references
the variable __initdata numa_nodes_parsed.
This is often because __next_node lacks a __initdata
annotation or the annotation of numa_nodes_parsed is wrong.

Mark __next_node() as __always_inline() so it won't get uninlined.
bloat-o-meter over x86_64 binaries says this:

scripts/bloat-o-meter -c vmlinux.baseline vmlinux
add/remove: 1/1 grow/shrink: 2/7 up/down: 446/-2166 (-1720)
Function                                     old     new   delta
apply_wqattrs_cleanup                          -     410    +410
amd_numa_init                                814     842     +28
sched_init_numa                             1338    1346      +8
find_next_bit                                 38      19     -19
__next_node                                   45       -     -45
apply_wqattrs_prepare                       1069     799    -270
wq_nice_store                                688     414    -274
wq_numa_store                                805     433    -372
wq_cpumask_store                             789     402    -387
apply_workqueue_attrs                        538     147    -391
workqueue_set_unbound_cpumask                947     539    -408
Total: Before=14422603, After=14420883, chg -0.01%

So it's both win-win in terms of resolving section mismatch and
saving some text size (-1.7 Kb is quite nice).

Signed-off-by: Alexander Lobakin <alexandr.lobakin@intel.com>
---
 include/linux/nodemask.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/nodemask.h b/include/linux/nodemask.h
index 567c3ddba2c4..55ba2c56f39b 100644
--- a/include/linux/nodemask.h
+++ b/include/linux/nodemask.h
@@ -266,7 +266,7 @@ static inline int __first_node(const nodemask_t *srcp)
 }
 
 #define next_node(n, src) __next_node((n), &(src))
-static inline int __next_node(int n, const nodemask_t *srcp)
+static __always_inline int __next_node(int n, const nodemask_t *srcp)
 {
 	return min_t(int,MAX_NUMNODES,find_next_bit(srcp->bits, MAX_NUMNODES, n+1));
 }
-- 
2.33.1


             reply	other threads:[~2021-12-06 16:22 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-06 16:17 Alexander Lobakin [this message]
2021-12-06 19:43 ` Nick Desaulniers
2021-12-06 20:57   ` Alexander Lobakin
2021-12-07  0:41   ` Nick Desaulniers
2021-12-07 11:27     ` Alexander Lobakin

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=20211206161745.39028-1-alexandr.lobakin@intel.com \
    --to=alexandr.lobakin@intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=arnd@arndb.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=nathan@kernel.org \
    --cc=ndesaulniers@google.com \
    --cc=thunder.leizhen@huawei.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®