LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Jisheng Zhang <Jisheng.Zhang@synaptics.com>
To: John Stultz <john.stultz@linaro.org>,
Thomas Gleixner <tglx@linutronix.de>,
Stephen Boyd <sboyd@kernel.org>
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH v2] timer: Use static_branch_likely() for timers_nohz_active
Date: Thu, 24 Jun 2021 16:32:18 +0800 [thread overview]
Message-ID: <20210624163218.39ae3ec6@xhacker.debian> (raw)
The static key timers_nohz_active is likely to be true, so use
static_branch_likely() to reflect this fact.
Per include/linux/jump_label.h:
* type\branch| likely (1) | unlikely (0)
* -----------+-----------------------+------------------
* | |
* true (1) | ... | ...
* | NOP | JMP L
* | <br-stmts> | 1: ...
* | L: ... |
* | |
* | | L: <br-stmts>
* | | jmp 1b
* | |
* -----------+-----------------------+------------------
This could improve the finally generated code a bit for the most likely
scenario, I.E save two "jmp" instructions.
Signed-off-by: Jisheng Zhang <Jisheng.Zhang@synaptics.com>
---
Since v1:
- update the commit msg to avoid confusing and add some descriptions about
where's the improvement from.
kernel/time/timer.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/time/timer.c b/kernel/time/timer.c
index d111adf4a0cb..40d4fe7fa207 100644
--- a/kernel/time/timer.c
+++ b/kernel/time/timer.c
@@ -265,7 +265,7 @@ int timer_migration_handler(struct ctl_table *table, int write,
static inline bool is_timers_nohz_active(void)
{
- return static_branch_unlikely(&timers_nohz_active);
+ return static_branch_likely(&timers_nohz_active);
}
#else
static inline bool is_timers_nohz_active(void) { return false; }
--
2.31.0
next reply other threads:[~2021-06-24 8:32 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-24 8:32 Jisheng Zhang [this message]
2021-08-10 16:00 ` Thomas Gleixner
2021-08-20 10:18 ` Jisheng Zhang
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=20210624163218.39ae3ec6@xhacker.debian \
--to=jisheng.zhang@synaptics.com \
--cc=john.stultz@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sboyd@kernel.org \
--cc=tglx@linutronix.de \
--subject='Re: [PATCH v2] timer: Use static_branch_likely() for timers_nohz_active' \
/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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).