linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Xie Yuanbin <qq570070308@gmail.com>
To: acme@kernel.org, adrian.hunter@intel.com, agordeev@linux.ibm.com,
	akpm@linux-foundation.org, alex@ghiti.fr,
	alexander.shishkin@linux.intel.com, andreas@gaisler.com,
	anna-maria@linutronix.de, anshuman.khandual@arm.com,
	aou@eecs.berkeley.edu, arnd@arndb.de, borntraeger@linux.ibm.com,
	bp@alien8.de, bsegall@google.com, dave.hansen@linux.intel.com,
	davem@davemloft.net, david@kernel.org, dietmar.eggemann@arm.com,
	frederic@kernel.org, gor@linux.ibm.com, hca@linux.ibm.com,
	hpa@zytor.com, irogers@google.com, james.clark@linaro.org,
	jolsa@kernel.org, juri.lelli@redhat.com, justinstitt@google.com,
	lorenzo.stoakes@oracle.com, luto@kernel.org,
	mark.rutland@arm.com, mathieu.desnoyers@efficios.com,
	max.kellermann@ionos.com, mgorman@suse.de, mingo@redhat.com,
	morbo@google.com, namhyung@kernel.org, nathan@kernel.org,
	nick.desaulniers+lkml@gmail.com, nysal@linux.ibm.com,
	palmer@dabbelt.com, paulmck@kernel.org, peterz@infradead.org,
	pjw@kernel.org, riel@surriel.com, rostedt@goodmis.org,
	ryan.roberts@arm.com, segher@kernel.crashing.org,
	svens@linux.ibm.com, tglx@linutronix.de, thuth@redhat.com,
	urezki@gmail.com, vincent.guittot@linaro.org,
	vschneid@redhat.com, linux@armlinux.org.uk
Cc: linux-kernel@vger.kernel.org, x86@kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org,
	sparclinux@vger.kernel.org, linux-perf-users@vger.kernel.org,
	llvm@lists.linux.dev
Subject: Re: [PATCH v4 0/3] Optimize code generation during context switching
Date: Sun, 30 Nov 2025 20:43:04 +0800	[thread overview]
Message-ID: <20251130124304.184107-1-qq570070308@gmail.com> (raw)
In-Reply-To: <20251123121827.1304-1-qq570070308@gmail.com>

On Sun, 23 Nov 2025 20:18:24 +0800, Xie Yuanbin wrote:
> This series of patches primarily make some functions called in context
> switching as always inline to optimize performance. Here is the
> performance test data for these patches:
> Time spent on calling finish_task_switch(), the unit is tsc from x86:
>  | test scenario             | old   | new   | delta          |
>  | gcc 15.2                  | 13.94 | 12.40 | 1.54  (-11.1%) |
>  | gcc 15.2 + spectre_v2     | 24.78 | 13.70 | 11.08 (-44.7%) |
>  | clang 21.1.4              | 13.90 | 12.71 | 1.19  (- 8.6%) |
>  | clang 21.1.4 + spectre_v2 | 29.01 | 18.91 | 10.1  (-34.8%) |

Hi everyone, I also conducted a performance test on raspberry pi 3b. I
hope this will be helpful in merging the patch.
The following is the test data:
Time spent on calling finish_task_switch(), the clocksource and unit is
cntvct_el0 from aarch64:
 | test scenario             | old  | new  | delta         |
 | gcc 15.2                  | 2.00 | 1.68 | 0.32 (-16.0%) |
 | clang 21.1.6              | 2.15 | 1.68 | 0.47 (-23.5%) |

Since raspberry pi 3b use a cortex-a53 processor, it is not affected by
the spectre v2 vulnerability, as is defined in
arch/arm64/kernel/proton-pack.c:
```c
	static const struct midr_range spectre_v2_safe_list[] = {
		MIDR_ALL_VERSIONS(MIDR_CORTEX_A35),
		MIDR_ALL_VERSIONS(MIDR_CORTEX_A53),
		MIDR_ALL_VERSIONS(MIDR_CORTEX_A55),
		MIDR_ALL_VERSIONS(MIDR_BRAHMA_B53),
		MIDR_ALL_VERSIONS(MIDR_HISI_TSV110),
		MIDR_ALL_VERSIONS(MIDR_QCOM_KRYO_2XX_SILVER),
		MIDR_ALL_VERSIONS(MIDR_QCOM_KRYO_3XX_SILVER),
		MIDR_ALL_VERSIONS(MIDR_QCOM_KRYO_4XX_SILVER),
		{ /* sentinel */ }
	};
```
Link: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/tree/arch/arm64/kernel/proton-pack.c?id=7d31f578f3230f3b7b33b0930b08f9afd8429817#n152

Perhaps I can test the performace with spectre_v2 mitigation enabled on
a raspberry pi 4b in the future.

In order to make the test result stable, I fixed the cpu frequency by
setting config.txt as following:
```config
core_freq_fixed=1
arm_freq=800
arm_freq_min=800
gpu_freq=300
core_freq=300
h264_freq=300
isp_freq=300
v3d_freq=300
hevc_freq=300
sdram_freq=400
gpu_freq_min=300
core_freq_min=300
h264_freq_min=300
isp_freq_min=300
v3d_freq_min=300
hevc_freq_min=300
sdram_freq_min=400
```

The test source is commit 7d31f578f323 ("Add linux-next specific files
for 20251128") from liunx-next branch. Using default defconfig config,
and setting:
CONFIG_ARM64_SVE=n
CONFIG_COMPAT=n
CONFIG_COMPAT_32BIT_TIME=n
CONFIG_ARM64_PTR_AUTH=n
CONFIG_ARM64_GCS=n
CONFIG_ARM64_MTE=n
CONFIG_SHADOW_CALL_STACK=y
CONFIG_SCHED_AUTOGROUP=n
CONFIG_CGROUPS=n
CONFIG_KVM=n
CONFIG_HZ_100=y
CONFIG_HZ=100

Thanks very much!

Xie Yuanbin

      parent reply	other threads:[~2025-11-30 12:43 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-23 12:18 [PATCH v4 0/3] Optimize code generation during context switching Xie Yuanbin
2025-11-23 12:18 ` [PATCH v4 1/3] x86/mm/tlb: Make enter_lazy_tlb() always inline on x86 Xie Yuanbin
2025-11-23 12:18 ` [PATCH v4 2/3] sched: Make raw_spin_rq_unlock() inline Xie Yuanbin
2025-11-23 12:18 ` [PATCH v4 3/3] sched/core: Make finish_task_switch() and its subfunctions always inline Xie Yuanbin
2025-11-30 12:43 ` Xie Yuanbin [this message]

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=20251130124304.184107-1-qq570070308@gmail.com \
    --to=qq570070308@gmail.com \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=agordeev@linux.ibm.com \
    --cc=akpm@linux-foundation.org \
    --cc=alex@ghiti.fr \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=andreas@gaisler.com \
    --cc=anna-maria@linutronix.de \
    --cc=anshuman.khandual@arm.com \
    --cc=aou@eecs.berkeley.edu \
    --cc=arnd@arndb.de \
    --cc=borntraeger@linux.ibm.com \
    --cc=bp@alien8.de \
    --cc=bsegall@google.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=davem@davemloft.net \
    --cc=david@kernel.org \
    --cc=dietmar.eggemann@arm.com \
    --cc=frederic@kernel.org \
    --cc=gor@linux.ibm.com \
    --cc=hca@linux.ibm.com \
    --cc=hpa@zytor.com \
    --cc=irogers@google.com \
    --cc=james.clark@linaro.org \
    --cc=jolsa@kernel.org \
    --cc=juri.lelli@redhat.com \
    --cc=justinstitt@google.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=llvm@lists.linux.dev \
    --cc=lorenzo.stoakes@oracle.com \
    --cc=luto@kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=max.kellermann@ionos.com \
    --cc=mgorman@suse.de \
    --cc=mingo@redhat.com \
    --cc=morbo@google.com \
    --cc=namhyung@kernel.org \
    --cc=nathan@kernel.org \
    --cc=nick.desaulniers+lkml@gmail.com \
    --cc=nysal@linux.ibm.com \
    --cc=palmer@dabbelt.com \
    --cc=paulmck@kernel.org \
    --cc=peterz@infradead.org \
    --cc=pjw@kernel.org \
    --cc=riel@surriel.com \
    --cc=rostedt@goodmis.org \
    --cc=ryan.roberts@arm.com \
    --cc=segher@kernel.crashing.org \
    --cc=sparclinux@vger.kernel.org \
    --cc=svens@linux.ibm.com \
    --cc=tglx@linutronix.de \
    --cc=thuth@redhat.com \
    --cc=urezki@gmail.com \
    --cc=vincent.guittot@linaro.org \
    --cc=vschneid@redhat.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;
as well as URLs for NNTP newsgroup(s).