All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Frederic Weisbecker <frederic@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>,
	LKML <linux-kernel@vger.kernel.org>,
	"Rafael J . Wysocki" <rafael.j.wysocki@intel.com>,
	Yunfeng Ye <yeyunfeng@huawei.com>,
	Marcelo Tosatti <mtosatti@redhat.com>
Subject: Re: [PATCH 1/8] tick/nohz: Evaluate the CPU expression after the static key
Date: Tue, 4 May 2021 14:31:29 +0200	[thread overview]
Message-ID: <YJE+oXuZ7KxxSMLK@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <20210422120158.33629-2-frederic@kernel.org>

On Thu, Apr 22, 2021 at 02:01:51PM +0200, Frederic Weisbecker wrote:
> From: Peter Zijlstra <peterz@infradead.org>
> 
> When tick_nohz_full_cpu() is called with smp_processor_id(), the latter
> is unconditionally evaluated whether the static key is on or off. It is
> not necessary in the off-case though, so make sure the cpu expression
> is executed at the last moment.
> 
> Illustrate with the following test function:
> 
> 	int tick_nohz_test(void)
> 	{
> 		return tick_nohz_full_cpu(smp_processor_id());
> 	}
> 
> The resulting code before was:
> 
> 	mov    %gs:0x7eea92d1(%rip),%eax   # smp_processor_id() fetch
> 	nopl   0x0(%rax,%rax,1)
> 	xor    %eax,%eax
> 	retq
> 	cmpb   $0x0,0x29d393a(%rip)        # <tick_nohz_full_running>
> 	je     tick_nohz_test+0x29         # jump to below eax clear
> 	mov    %eax,%eax
> 	bt     %rax,0x29d3936(%rip)        # <tick_nohz_full_mask>
> 	setb   %al
> 	movzbl %al,%eax
> 	retq
> 	xor    %eax,%eax
> 	retq
> 
> Now it becomes:
> 
> 	nopl   0x0(%rax,%rax,1)
> 	xor    %eax,%eax
> 	retq
> 	cmpb   $0x0,0x29d3871(%rip)        # <tick_nohz_full_running>
> 	je     tick_nohz_test+0x29         # jump to below eax clear
> 	mov    %gs:0x7eea91f0(%rip),%eax   # smp_processor_id() fetch, after static key
> 	mov    %eax,%eax
> 	bt     %rax,0x29d3866(%rip)        # <tick_nohz_full_mask>
> 	setb   %al
> 	movzbl %al,%eax
> 	retq
> 	xor    %eax,%eax
> 	retq
> 
> Not-Yet-Signed-off-by: Peter Zijlstra <peterz@infradead.org>

Signed-off-by: Peter Zijlstra <peterz@infradead.org>

Thanks for writing the Changelog.

  reply	other threads:[~2021-05-04 12:31 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-22 12:01 [PATCH 0/8] tick/nohz updates v2 Frederic Weisbecker
2021-04-22 12:01 ` [PATCH 1/8] tick/nohz: Evaluate the CPU expression after the static key Frederic Weisbecker
2021-05-04 12:31   ` Peter Zijlstra [this message]
2021-04-22 12:01 ` [PATCH 2/8] tick/nohz: Conditionally restart tick on idle exit Frederic Weisbecker
2021-04-22 12:01 ` [PATCH 3/8] tick/nohz: Remove superflous check for CONFIG_VIRT_CPU_ACCOUNTING_NATIVE Frederic Weisbecker
2021-05-04 12:40   ` Peter Zijlstra
2021-04-22 12:01 ` [PATCH 4/8] tick/nohz: Update idle_exittime on actual idle exit Frederic Weisbecker
2021-04-22 12:01 ` [PATCH 5/8] tick/nohz: Update nohz_full Kconfig help Frederic Weisbecker
2021-04-22 12:01 ` [PATCH 6/8] tick/nohz: Only wakeup a single target cpu when kicking a task Frederic Weisbecker
2021-05-05 13:43   ` Peter Zijlstra
2021-05-10 10:39     ` Frederic Weisbecker
2021-05-10 10:48       ` Peter Zijlstra
2021-05-10 10:54         ` Frederic Weisbecker
2021-04-22 12:01 ` [PATCH 7/8] tick/nohz: Change signal tick dependency to wakeup CPUs of member tasks Frederic Weisbecker
2021-04-22 12:01 ` [PATCH 8/8] tick/nohz: Kick only _queued_ task whose tick dependency is updated Frederic Weisbecker
2021-05-05 13:57   ` Peter Zijlstra
2021-05-10 10:52     ` Frederic Weisbecker
2021-05-05 13:57 ` [PATCH 0/8] tick/nohz updates v2 Peter Zijlstra

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=YJE+oXuZ7KxxSMLK@hirez.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=frederic@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    --cc=rafael.j.wysocki@intel.com \
    --cc=tglx@linutronix.de \
    --cc=yeyunfeng@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.