Re: [PATCH] perf test: Compile named_threads workload with -O0
From: David Laight
Date: Thu Jun 11 2026 - 14:55:56 EST
On Thu, 11 Jun 2026 12:13:46 +0100
James Clark <james.clark@xxxxxxxxxx> wrote:
> The work loop relies on the compiler not optimizing it away, although
> named_threads_work is not static for that reason, the compiler could
> still do it.
Isn't in enough to put barrier() in the loop?
David
>
> Fix it by compiling without optimization. Also add -fno-inline for
> consistency and in case anyone wants to look at callstacks.
>
> Signed-off-by: James Clark <james.clark@xxxxxxxxxx>
> ---
> One trailing Sashiko fix from the "perf cs-etm: Queue context packets
> for frontend" patch series that has been applied already.
> ---
> tools/perf/tests/workloads/Build | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/tools/perf/tests/workloads/Build b/tools/perf/tests/workloads/Build
> index 75b377934a0e..7bb4b9829ba2 100644
> --- a/tools/perf/tests/workloads/Build
> +++ b/tools/perf/tests/workloads/Build
> @@ -26,3 +26,4 @@ CFLAGS_datasym.o = -g -O0 -fno-inline -U_FORTIFY_SOURCE
> CFLAGS_traploop.o = -g -O0 -fno-inline -U_FORTIFY_SOURCE
> CFLAGS_inlineloop.o = -g -O2
> CFLAGS_deterministic.o = -g -O0 -fno-inline -U_FORTIFY_SOURCE
> +CFLAGS_named_threads.o = -g -O0 -fno-inline -U_FORTIFY_SOURCE
>
> ---
> base-commit: 7336514f41e75d44782fee7e0990d4195a3d3161
> change-id: 20260611-james-cs-unformatted-per-thread-fix-followup-babf28a4e640
>
> Best regards,