Re: [RFC PATCH v2 00/17] Core scheduling v2

From: Aubrey Li
Date: Sat Apr 27 2019 - 00:00:53 EST


On Thu, Apr 25, 2019 at 5:55 PM Ingo Molnar <mingo@xxxxxxxxxx> wrote:
> * Aubrey Li <aubrey.intel@xxxxxxxxx> wrote:
> > On Wed, Apr 24, 2019 at 10:00 PM Julien Desfossez
> > <jdesfossez@xxxxxxxxxxxxxxxx> wrote:
> > >
> > > On 24-Apr-2019 09:13:10 PM, Aubrey Li wrote:
> > > > On Wed, Apr 24, 2019 at 12:18 AM Vineeth Remanan Pillai
> > > > <vpillai@xxxxxxxxxxxxxxxx> wrote:
> > > > >
> > > > > Second iteration of the core-scheduling feature.
> > > > >
> > > > > This version fixes apparent bugs and performance issues in v1. This
> > > > > doesn't fully address the issue of core sharing between processes
> > > > > with different tags. Core sharing still happens 1% to 5% of the time
> > > > > based on the nature of workload and timing of the runnable processes.
> > > > >
> > > > > Changes in v2
> > > > > -------------
> > > > > - rebased on mainline commit: 6d906f99817951e2257d577656899da02bb33105
> > > >
> > > > Thanks to post v2, based on this version, here is my benchmarks result.
> > > >
> > > > Environment setup
> > > > --------------------------
> > > > Skylake server, 2 numa nodes, 104 CPUs (HT on)
> > > > cgroup1 workload, sysbench (CPU intensive non AVX workload)
> > > > cgroup2 workload, gemmbench (AVX512 workload)
> > > >
> > > > Case 1: task number < CPU num
> > > > --------------------------------------------
> > > > 36 sysbench threads in cgroup1
> > > > 36 gemmbench threads in cgroup2
> > > >
> > > > core sched off:
> > > > - sysbench 95th percentile latency(ms): avg = 4.952, stddev = 0.55342
> > > > core sched on:
> > > > - sysbench 95th percentile latency(ms): avg = 3.549, stddev = 0.04449
> > > >
> > > > Due to core cookie matching, sysbench tasks won't be affect by AVX512
> > > > tasks, latency has ~28% improvement!!!
> > > >
> > > > Case 2: task number > CPU number
> > > > -------------------------------------------------
> > > > 72 sysbench threads in cgroup1
> > > > 72 gemmbench threads in cgroup2
> > > >
> > > > core sched off:
> > > > - sysbench 95th percentile latency(ms): avg = 11.914, stddev = 3.259
> > > > core sched on:
> > > > - sysbench 95th percentile latency(ms): avg = 13.289, stddev = 4.863
> > > >
> > > > So not only power, now security and performance is a pair of contradictions.
> > > > Due to core cookie not matching and forced idle introduced, latency has ~12%
> > > > regression.
> > > >
> > > > Any comments?
> > >
> > > Would it be possible to post the results with HT off as well ?
> >
> > What's the point here to turn HT off? The latency is sensitive to the
> > relationship
> > between the task number and CPU number. Usually less CPU number, more run
> > queue wait time, and worse result.
>
> HT-off numbers are mandatory: turning HT off is by far the simplest way
> to solve the security bugs in these CPUs.
>
> Any core-scheduling solution *must* perform better than HT-off for all
> relevant workloads, otherwise what's the point?
>
I have the same environment setup above, for nosmt cases, I used
/sys interface Thomas mentioned, below is the result:

NA/AVX baseline(std%) coresched(std%) +/- nosmt(std%) +/-
1/1 1.987( 1.97%) 2.043( 1.76%) -2.84% 1.985( 1.70%) 0.12%
NA/AVX baseline(std%) coresched(std%) +/- nosmt(std%) +/-
2/2 2.074( 1.16%) 2.057( 2.09%) 0.81% 2.072( 0.77%) 0.10%
NA/AVX baseline(std%) coresched(std%) +/- nosmt(std%) +/-
4/4 2.140( 0.00%) 2.138( 0.49%) 0.09% 2.137( 0.89%) 0.12%
NA/AVX baseline(std%) coresched(std%) +/- nosmt(std%) +/-
8/8 2.140( 0.00%) 2.144( 0.53%) -0.17% 2.140( 0.00%) 0.00%
NA/AVX baseline(std%) coresched(std%) +/- nosmt(std%) +/-
16/16 2.361( 2.99%) 2.369( 2.65%) -0.30% 2.406( 2.53%) -1.87%
NA/AVX baseline(std%) coresched(std%) +/- nosmt(std%) +/-
32/32 5.032( 8.68%) 3.485( 0.49%) 30.76% 6.002(27.21%) -19.27%
NA/AVX baseline(std%) coresched(std%) +/- nosmt(std%) +/-
64/64 7.577(34.35%) 3.972(23.18%) 47.57% 18.235(14.14%) -140.68%
NA/AVX baseline(std%) coresched(std%) +/- nosmt(std%) +/-
128/128 24.639(14.28%) 27.440( 8.24%) -11.37% 34.746( 6.92%) -41.02%
NA/AVX baseline(std%) coresched(std%) +/- nosmt(std%) +/-
256/256 38.797( 8.59%) 44.067(16.20%) -13.58% 42.536( 7.57%) -9.64%

Thanks,
-Aubrey