All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Arnaldo Carvalho de Melo" <acme@kernel.org>
Cc: linux-perf-users@vger.kernel.org
Subject: Re: [PATCH 5/5] perf test: Add false_sharing workload exhibiting cross-CPU false sharing
Date: Tue, 29 Sep 2026 20:25:49 +0000	[thread overview]
Message-ID: <20260929202549.EE88E1F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260929201524.2507733-6-acme@kernel.org>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] perf/tests: sparse topology CPU discovery misses allowed CPUs
--

commit 20aa23e4b03f823c93c6019527a360319667c8b2
Author: Arnaldo Carvalho de Melo <acme@redhat.com>

perf test: Add false_sharing workload exhibiting cross-CPU false sharing

This commit adds a 'perf test -w false_sharing' workload that simulates false
sharing across CPUs in a TCP connection structure to test data type profiling.

> diff --git a/tools/perf/tests/workloads/false_sharing.c b/tools/perf/tests/workloads/false_sharing.c
> new file mode 100644
> index 0000000000000..344875fb3a4d9
> --- /dev/null
> +++ b/tools/perf/tests/workloads/false_sharing.c

[ ... ]

> +	/* Pin against the allowed set, restricted cpusets still spread the threads. */
> +	ncpus = sysconf(_SC_NPROCESSORS_CONF);
> +	if (sched_getaffinity(0, sizeof(set), &set) == 0) {

[Severity: Medium]
Does this loop correctly handle sparse CPU topologies?
sysconf(_SC_NPROCESSORS_CONF) returns the count of configured CPUs, not the
maximum CPU ID. On a system where only higher CPU IDs are present (for
example, if only CPUs 16-19 are configured, ncpus is 4), bounding the loop by
i < ncpus will stop checking at ID 3. This could cause the test to miss
allowed CPUs and fall back to unpinned execution, compromising the false
sharing demonstration.

> +		for (i = 0; i < ncpus && i < CPU_SETSIZE; i++) {
> +			if (!CPU_ISSET(i, &set))
> +				continue;
> +			nr_allowed++;
> +		}
> +		allowed = malloc(nr_allowed * sizeof(int));
> +		if (allowed == NULL) {
> +			fprintf(stderr, "Error: malloc failed for CPU list\n");
> +			return 1;
> +		}

[Severity: Medium]
Is this second discovery loop also affected by the same boundary logic issue?

> +		for (i = 0; i < ncpus && i < CPU_SETSIZE; i++) {
> +			if (CPU_ISSET(i, &set))
> +				allowed[nallowed++] = i;
> +		}
> +	}

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260929201524.2507733-1-acme@kernel.org?part=5

  reply	other threads:[~2026-09-29 20:25 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-29 20:15 [PATCH v4 0/5] perf tools: Add progress diagnostics and a false-sharing workload Arnaldo Carvalho de Melo
2026-09-29 20:15 ` [PATCH 1/5] perf config: Move perf_config__set_variable() to util/config.c Arnaldo Carvalho de Melo
2026-09-29 20:27   ` sashiko-bot
2026-09-29 20:15 ` [PATCH 2/5] perf report: Add --progress option Arnaldo Carvalho de Melo
2026-09-29 20:23   ` sashiko-bot
2026-09-29 20:15 ` [PATCH 3/5] perf report: Add --no-progress option Arnaldo Carvalho de Melo
2026-09-29 20:24   ` sashiko-bot
2026-09-29 20:15 ` [PATCH 4/5] perf scripts: Add perf-stuck, to tell where a running perf is stuck Arnaldo Carvalho de Melo
2026-09-29 20:22   ` sashiko-bot
2026-09-29 20:15 ` [PATCH 5/5] perf test: Add false_sharing workload exhibiting cross-CPU false sharing Arnaldo Carvalho de Melo
2026-09-29 20:25   ` sashiko-bot [this message]
  -- strict thread matches above, loose matches on Subject: below --
2026-09-29 21:22 [PATCH v5 0/5] perf tools: Add progress diagnostics and a false-sharing workload Arnaldo Carvalho de Melo
2026-09-29 21:22 ` [PATCH 5/5] perf test: Add false_sharing workload exhibiting cross-CPU false sharing Arnaldo Carvalho de Melo
2026-09-29 21:28   ` sashiko-bot

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=20260929202549.EE88E1F000FF@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=acme@kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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.