----- On Oct 2, 2020, at 4:33 AM, Rong Chen rong.a.chen(a)intel.com wrote:
FYI, we noticed a -37.0% regression of will-it-scale.per_thread_ops due to
commit: bdfcae11403e5099769a7c8dc3262e3c4193edef ("[RFC PATCH 2/3] sched:
membarrier: cover kthread_use_mm (v3)")
in testcase: will-it-scale
on test machine: 104 threads Skylake with 192G memory
with following parameters:
test-description: Will It Scale takes a testcase and runs it from 1 through to n
parallel copies to see if the testcase will scale. It builds both a process and
threads based test in order to see any differences between the two.
I would like to report what I suspect is a random thread placement issue in the
context_switch1 test used by the 0day bot when running on a machine with hyperthread
AFAIU the test code uses hwloc for thread placement which should theoretically ensure
that each thread is placed on same processing unit, core and numa node between runs.
We can find the test code here:
And the main file containing thread setup is here:
AFAIU, the test is started without the "-m" switch, which therefore affinitizes
tasks on cores rather than on processing units (SMT threads).
When testcase() creates the child thread with new_task(), it basically issues:
pthread_create(&threads[nr_threads++], NULL, func, arg);
passing a NULL pthread_attr_t, and not executing any pre_trampoline on the child.
The pre_trampoline would have issued hwloc_set_thread_cpubind if it were executed on
the child, but it's not. Therefore, we expect the cpu affinity mask of the parent to
be copied on clone and used by the child.
A quick test on a machine with hyperthreading enabled shows that the cpu affinity mask
for the parent and child has two bits set:
taskset -p 1868607
pid 1868607's current affinity mask: 10001
taskset -p 1868606
pid 1868606's current affinity mask: 10001
So AFAIU the placement of the parent and child will be random on either the same
processing unit, or on separate processing units within the same core.
I suspect this randomness can significantly affect the performance number between
runs, and trigger unwarranted performance regression warnings.