lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 9 Jan 2023 14:00:11 -0800
From:   Libo Chen <libo.chen@...cle.com>
To:     Peter Zijlstra <peterz@...radead.org>
Cc:     mingo@...hat.com, vincent.guittot@...aro.org,
        juri.lelli@...hat.com, dietmar.eggemann@....com, mgorman@...e.de,
        linux-kernel@...r.kernel.org,
        Daniel Jordan <daniel.m.jordan@...cle.com>
Subject: Re: [PATCH 1/1] sched/fair: Fix inaccurate tally of ttwu_move_affine

Hi Peter,

A gentle ping~ Vincent has signed it off. Let me know what else I should 
do for this patch.

Libo

On 8/15/22 12:19 PM, Libo Chen wrote:
>
>
> On 8/15/22 04:01, Peter Zijlstra wrote:
>> On Wed, Aug 10, 2022 at 03:33:13PM -0700, Libo Chen wrote:
>>> There are scenarios where non-affine wakeups are incorrectly counted as
>>> affine wakeups by schedstats.
>>>
>>> When wake_affine_idle() returns prev_cpu which doesn't equal to
>>> nr_cpumask_bits, it will slip through the check: target == 
>>> nr_cpumask_bits
>>> in wake_affine() and be counted as if target == this_cpu in schedstats.
>>>
>>> Replace target == nr_cpumask_bits with target != this_cpu to make sure
>>> affine wakeups are accurately tallied.
>>>
>>> Fixes: 806486c377e33 (sched/fair: Do not migrate if the prev_cpu is 
>>> idle)
>>> Suggested-by: Daniel Jordan <daniel.m.jordan@...cle.com>
>>> Signed-off-by: Libo Chen <libo.chen@...cle.com>
>>> ---
>>>   kernel/sched/fair.c | 2 +-
>>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
>>> index da388657d5ac..b179da4f8105 100644
>>> --- a/kernel/sched/fair.c
>>> +++ b/kernel/sched/fair.c
>>> @@ -6114,7 +6114,7 @@ static int wake_affine(struct sched_domain 
>>> *sd, struct task_struct *p,
>>>           target = wake_affine_weight(sd, p, this_cpu, prev_cpu, sync);
>>>         schedstat_inc(p->stats.nr_wakeups_affine_attempts);
>>> -    if (target == nr_cpumask_bits)
>>> +    if (target != this_cpu)
>>>           return prev_cpu;
>>>         schedstat_inc(sd->ttwu_move_affine);
>> This not only changes the accounting but also the placement, no?
> No, it should only change the accounting. wake_affine() still returns 
> prev_cpu if target equals to prev_cpu or nr_cpumask_bits, the same 
> behavior as before.
>
>
> Libo

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ