The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Fenghua Yu <fenghua.yu@intel.com>
To: "Luck, Tony" <tony.luck@intel.com>,
	Peter Newman <peternewman@google.com>,
	"Chatre, Reinette" <reinette.chatre@intel.com>
Cc: Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	"x86@kernel.org" <x86@kernel.org>,
	"H . Peter Anvin" <hpa@zytor.com>,
	"Babu Moger" <babu.moger@amd.com>,
	James Morse <james.morse@arm.com>,
	"Martin Kletzander" <nert.pinx@gmail.com>,
	Shaopeng Tan <tan.shaopeng@fujitsu.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"Eranian, Stephane" <eranian@google.com>
Subject: Re: [PATCH 2/2] x86/resctrl: Don't workqueue local event counter reads
Date: Mon, 4 Nov 2024 15:59:03 -0800	[thread overview]
Message-ID: <8a76c5df-3982-c53a-9643-4b6b1de290e2@intel.com> (raw)
In-Reply-To: <SJ1PR11MB608357ED39FA4FA1C85C6DB2FC512@SJ1PR11MB6083.namprd11.prod.outlook.com>

Hi, Tony,

On 11/4/24 14:56, Luck, Tony wrote:
>>    	cpu = cpumask_any_housekeeping(cpumask, RESCTRL_PICK_ANY_CPU);
> 
> To a large degree Peter's is working around inefficiency in this housekeeping
> call.
> 
> Code may be running on a suitable CPU from the domain cpumask, but this
> call will very likely pick the first CPU in that mask, rather than the current one.

Agree.

> 
>  From that point it's all downhill unless you are lucky enough that the first
> CPU is a tick_nohz_full_cpu() one and you take the
> 
> 	smp_call_function_any(cpumask, mon_event_count, rr, 1);

Whenever this function is called, the performance is degraded rather 
than improved because extra get_cpu()/put_cpu() are called in the fast 
path in the current patch.

On platforms that have less housekeeping CPUs (e.g. a RT platform), 
there could be a higher chance that the first CPU is a nohz_full CPU and 
run smp_call_function_any().

> 
> path. It seems that on many systems you'll take the
> 
> 	smp_call_on_cpu(cpu, smp_mon_event_count, rr, false);
> 
> path and make a pointless IPI to get the data.

Yes, that's right. But it's not conflicting with my suggested change.

What I suggested is to move the fast path code to this case only. So the 
fast path is always checked/called in both cases if condition is met:
1. It's already checked/called inside smp_call_function_any() in 
nohz_full case. No need to call out the fast path separately.
    - No extra get_cpu() and put_cpu() are called.
    - The performance is better than the current patch.
2. It's called out in non nohz_full case. No performance difference from 
the current patch.

Thanks.

-Fenghua

  reply	other threads:[~2024-11-04 23:58 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-31 14:25 [PATCH 1/2] selftests/resctrl: fastcat for benchmarking counter reads Peter Newman
2024-10-31 14:25 ` [PATCH 2/2] x86/resctrl: Don't workqueue local event " Peter Newman
2024-11-01 18:35   ` Luck, Tony
2024-11-04 22:36   ` Fenghua Yu
2024-11-04 22:56     ` Luck, Tony
2024-11-04 23:59       ` Fenghua Yu [this message]
2024-11-05  0:12         ` Luck, Tony
2024-11-05  3:29           ` Fenghua Yu
2024-11-05 11:25     ` Peter Newman
2024-11-05 23:20       ` Reinette Chatre
2024-11-05 23:39         ` Luck, Tony
2024-11-06  0:13           ` Reinette Chatre
2024-11-06  9:42             ` Peter Newman
2024-11-06 17:12               ` Luck, Tony
2024-11-06 15:52       ` Peter Newman

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=8a76c5df-3982-c53a-9643-4b6b1de290e2@intel.com \
    --to=fenghua.yu@intel.com \
    --cc=babu.moger@amd.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=eranian@google.com \
    --cc=hpa@zytor.com \
    --cc=james.morse@arm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=nert.pinx@gmail.com \
    --cc=peternewman@google.com \
    --cc=reinette.chatre@intel.com \
    --cc=tan.shaopeng@fujitsu.com \
    --cc=tglx@linutronix.de \
    --cc=tony.luck@intel.com \
    --cc=x86@kernel.org \
    /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