Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp379562pxj; Fri, 7 May 2021 10:34:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxXzJebtEX87JlHZjs95c7sb5efUgLHgDv8Nq5YX2FFas5UJTrsHzw46YcG4UHXvZhFdF2U X-Received: by 2002:a62:1517:0:b029:28e:a871:ffb2 with SMTP id 23-20020a6215170000b029028ea871ffb2mr11449538pfv.19.1620408843572; Fri, 07 May 2021 10:34:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620408843; cv=none; d=google.com; s=arc-20160816; b=liRhK8/MYlo+SfnXsrtqMqrsJO/3UJJQhZVkpCeTa2rcCL3QtJSQZRQ6E7HFryMDC7 gE+bLbQ5Bg79/4JfI26RYg2Cv/w++pES2AiR4vAnHcoO4Jo9U0A30UO0YtZsGDSGtP2J XrGomky9mWQx7UvAoOIrMyKPA9jGOjHbxicrg2zT5GyOhFaf+47LHodJ4yRjxUgUNwRg vijp419o/otC1XehrIQXgoso/DgmDNVJM2N1HGvViMEH7CLUlsk1nsiUd2AUqMBUTwEC VNCKD54VWHdiOc/e5ToeFmxRC4yYhaANiCl3dydR4Xdjq5uziTak177vgLcZhfKoQCsN VuXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from; bh=G+zjJc+SWalLyirTM9ilTwxSVjJ+ZTBtVJK0/mHs+7E=; b=xpzikYgeRElXo5nUfxslRvlN0P08RBp4OGfCWuiYkVk2yV9Pn75X5T6Loj6IDscQgm 51e2ElT87XbfMHEACIEywCQTK36vlm50eobxGr83rORipn4izzLcH8QYkHOnafxah5v2 jwbn8MhYpzDKpgQqL1GryVAaUIKmDIzQ40UVmiiSmU3XKTMEJzz02WctZdgxNjVk2wLO XViumgMPWzwdu4s0/MGGuTDujR1+Ifgma706cw5wMS87SrSbFMvrxQse/D8ncfMqRf7j 6ZsZRyDme5SAxG7O3cnpBNDkfl7iLZGfGRO+TS6xqR7MXixMAdFz1m1SP2vr5WbjPqgh qynQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a4si7627981pgt.26.2021.05.07.10.33.51; Fri, 07 May 2021 10:34:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238059AbhEGQJ3 (ORCPT + 99 others); Fri, 7 May 2021 12:09:29 -0400 Received: from foss.arm.com ([217.140.110.172]:35078 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236176AbhEGQJ0 (ORCPT ); Fri, 7 May 2021 12:09:26 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 0B0B811B3; Fri, 7 May 2021 09:08:26 -0700 (PDT) Received: from e113632-lin (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 757BF3F73B; Fri, 7 May 2021 09:08:24 -0700 (PDT) From: Valentin Schneider To: Srikar Dronamraju , Ingo Molnar , Peter Zijlstra Cc: LKML , Mel Gorman , Rik van Riel , Srikar Dronamraju , Thomas Gleixner , Vincent Guittot , Dietmar Eggemann , Gautham R Shenoy , Parth Shah Subject: Re: [PATCH v2 1/8] sched/fair: Update affine statistics when needed In-Reply-To: <20210506164543.90688-2-srikar@linux.vnet.ibm.com> References: <20210506164543.90688-1-srikar@linux.vnet.ibm.com> <20210506164543.90688-2-srikar@linux.vnet.ibm.com> Date: Fri, 07 May 2021 17:08:17 +0100 Message-ID: <87sg2yil1q.mognet@arm.com> MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 06/05/21 22:15, Srikar Dronamraju wrote: > wake_affine_idle() can return prev_cpu. Even in such a scenario, > scheduler was going ahead and updating schedstats related to wake > affine. i.e even if the task is not moved across LLC domains, > schedstats would have accounted. > > Hence add a check before updating schedstats. > I briefly glanced at the git history but didn't find any proper description of that stat. As it stands, it counts the number of times wake_affine() purposedly steered a task towards a particular CPU (waker or wakee's prev), so nr_wakeups_affine / nr_wakeups_affine_attempts is your wake_affine() "success rate" - how often could it make a choice with the available data. I could see a point in only incrementing the count if wake_affine() steers towards the waker rather than the wakee (i.e. don't increment if choice is prev), but then that has no link with LLC spans > Cc: LKML > Cc: Gautham R Shenoy > Cc: Parth Shah > Cc: Ingo Molnar > Cc: Peter Zijlstra > Cc: Valentin Schneider > Cc: Dietmar Eggemann > Cc: Mel Gorman > Cc: Vincent Guittot > Cc: Rik van Riel > Signed-off-by: Srikar Dronamraju > --- > kernel/sched/fair.c | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c > index 794c2cb945f8..a258a84cfdfd 100644 > --- a/kernel/sched/fair.c > +++ b/kernel/sched/fair.c > @@ -5884,8 +5884,10 @@ static int wake_affine(struct sched_domain *sd, struct task_struct *p, > if (target == nr_cpumask_bits) > return prev_cpu; > > - schedstat_inc(sd->ttwu_move_affine); > - schedstat_inc(p->se.statistics.nr_wakeups_affine); > + if (!cpus_share_cache(prev_cpu, target)) { Per the above, why? Why not just if(target == this_cpu) ? > + schedstat_inc(sd->ttwu_move_affine); > + schedstat_inc(p->se.statistics.nr_wakeups_affine); > + } > return target; > } > > -- > 2.18.2