Linux Test Project
 help / color / mirror / Atom feed
From: linuxtestproject.agent@gmail.com
To: Jan Stancek <jstancek@redhat.com>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] getrusage03: Pin the test to a single CPU
Date: Fri,  4 Sep 2026 12:17:17 +0000	[thread overview]
Message-ID: <20260904121717.8675-1-linuxtestproject.agent@gmail.com> (raw)
In-Reply-To: <a308e12198ce96305761a009858fa4a80c91f932.1788518850.git.jstancek@redhat.com>

Hi Jan,

On Sep 4, 2026, Jan Stancek wrote:
> getrusage03: Pin the test to a single CPU

> +/*
> + * Pin the process (and everything it forks) to the CPU it currently runs on.
> + * Since commit f1a7941243c1 ("mm: convert mm's rss stats into percpu_counter")
> + * the RSS is tracked in a percpu counter whose fast read
> + * (percpu_counter_read_positive) only returns the global count, ignoring the
> + * per-CPU caches.

High: This setup makes the affected 100 MB child report pass instead of
exposing the approximately 64 MB getrusage(2) result. That is a kernel bug
workaround; keep the test migratable so the incorrect result remains visible.

> +	unsigned int cpu;
> +	cpu_set_t set;
> +
> +	if (getcpu(&cpu, NULL))
> +		tst_brk(TBROK | TERRNO, "getcpu() failed");
> +
> +	CPU_ZERO(&set);
> +	CPU_SET(cpu, &set);
> +	if (sched_setaffinity(0, sizeof(set), &set))
> +		tst_brk(TBROK | TERRNO, "sched_setaffinity() failed");

Medium: cpu_set_t cannot represent valid CPU IDs of CPU_SETSIZE or higher, so
CPU_SET() leaves the mask empty and sched_setaffinity() fails with EINVAL.
Use a dynamically allocated mask with CPU_ALLOC_SIZE(tst_ncpus_max()) and the
CPU_ZERO_S()/CPU_SET_S() interfaces.

Verdict - Needs revision

---
Note:

The agent can sometimes produce false positives although often its
findings are genuine. If you find issues with the review, please
comment this email or ignore the suggestions.

Regards,
LTP AI Reviewer

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

      parent reply	other threads:[~2026-09-04 12:18 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-04 10:48 [LTP] [PATCH] getrusage03: Pin the test to a single CPU Jan Stancek via ltp
2026-09-04 12:03 ` Andrea Cervesato via ltp
2026-09-12 16:05   ` Jan Stancek via ltp
2026-09-04 12:17 ` linuxtestproject.agent [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=20260904121717.8675-1-linuxtestproject.agent@gmail.com \
    --to=linuxtestproject.agent@gmail.com \
    --cc=jstancek@redhat.com \
    --cc=ltp@lists.linux.it \
    /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