Re: [PATCH v3 23/29] selftests/resctrl: Restore the CPU affinity after CAT test

Ilpo Järvinen
2023-12-14T10:25:24Z

[-- Attachment #1: Type: text/plain, Size: 1496 bytes --]

On Wed, 13 Dec 2023, Reinette Chatre wrote:
> On 12/11/2023 4:18 AM, Ilpo Järvinen wrote:
> > CAT test does not reset the CPU affinity after the benchmark.
> > This is relatively harmless as is because CAT test is the last
> > benchmark to run, however, more tests may be added later.
> >
> > Store the CPU affinity the first time taskset_benchmark() is run and
> > add taskset_restore() which the test can call to reset the CPU mask to
> > its original value.
> >
> > Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
> > ---

> > +/*
> > + * taskset_restore - Taskset PID to the earlier CPU affinity
> > + * @bm_pid: PID that should be reset
> > + * @old_affinity: The old CPU affinity to restore
> > + *
> > + * Return: 0 on success, < 0 on error.
> > + */
> > +int taskset_restore(pid_t bm_pid, cpu_set_t *old_affinity)
> > +{
> > + if (sched_setaffinity(bm_pid, sizeof(*old_affinity), old_affinity)) {
> > + ksft_perror("Unable to restore taskset");
>
> This message is not clear to me. How about "Unable to restore CPU affinity"?

Okay, I can change that. I actually was on the edge what to with these
because I was just trying to be consistent with the existing error message
in taskset_benchmark(). I reasoned that because "taskset" is the userspace
tool which the user might be familiar the original idea of using
"taskset" might be helpful.

And now rereading what I wrote in that message, "restore taskset" does not
sound very sensical grammarwise. :-)

--
i.