Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp339862pxy; Thu, 22 Apr 2021 03:26:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzAtCBo0tqV6nxDz9GKW1LiF26jG4uqVs6PDaZJoZ8lYppnP1lEdvd8C6CvpfphyCvpHl1W X-Received: by 2002:a62:808e:0:b029:25f:1cf2:94fa with SMTP id j136-20020a62808e0000b029025f1cf294famr2725188pfd.25.1619087167155; Thu, 22 Apr 2021 03:26:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619087167; cv=none; d=google.com; s=arc-20160816; b=CTWpAuLSp6PMvcEirsV/F5jetlwmfCPTVjoNuESp8HhDC+EBDYWwjpoI84EChOHnsg yJaiSsTyCcH2T6SdVrAMqwgCmRt6Ry341vDPHS9luCR4x2sfPbEqF6xPT/Atoh8PTCB0 +XcymHBKiM3swHhduK9G5qKE/HVhfp2wX9iG99wUiCT1hbItSFUNuW/u6xhexnJ3eyJe tAGkk6SGuo0qaf420Ut+j2pao4ZqXCJLReNPiVj5WzKcHYhDirRhfpn2PzUbYbjvc+bX DKo3HZ1mv9XC7QqnV/91bXfFOaor/m6pTV+3l8ojbOzHj0zXthtTadOsqPrVunsW/EU6 gJLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=gkFtMqKi2aEYemt9CKXS7Yh64Vz+DgUGgBkE+O3HXgo=; b=G9XPoOTriO3MEBbOlZlqzavjqU90BRMJmlYVSKYsQYIm3MTmWUp5QVliF+qvCIzNRX mA1Hb9XZOVTFzlXyRCwmMXLkL503rtVOkr4gtnOnw3UErxNn77IrlOgtY97X6+8hEj6k K3FD4z+rR3dvl4T7HOpgzAX1mDuW+2KaQjvsSV2k81/LlXP+7ckS0ktLQCEzVb1ShS2O MMdNr9AojkfbDcxq7MVIhCHoCz2rtrEhjw4asXajmkKXV1HonBsU/CCjDqc3j4dwHnWR 5W/a9LmxDMgPXr7oYLJKWc1QmzKXlLzPBDFpU44KSBpmGbhGXO/2faFMm28lDq/UlldQ w7Rg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=rmTlQn8Z; 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=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s11si2839852plp.26.2021.04.22.03.25.55; Thu, 22 Apr 2021 03:26:07 -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; dkim=pass header.i=@ibm.com header.s=pp1 header.b=rmTlQn8Z; 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=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235830AbhDVKYv (ORCPT + 99 others); Thu, 22 Apr 2021 06:24:51 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:42144 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235097AbhDVKYr (ORCPT ); Thu, 22 Apr 2021 06:24:47 -0400 Received: from pps.filterd (m0187473.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 13MA4nND089648; Thu, 22 Apr 2021 06:23:47 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=gkFtMqKi2aEYemt9CKXS7Yh64Vz+DgUGgBkE+O3HXgo=; b=rmTlQn8ZEWMgALmmSBJtyMXoRr7V+1SUzMntDudj/Je2bDtDRxo1NInkJMwYok5O9iPw lYus5fVD/cqFxex7Bc8r2FrZdqLQET1Pyn8IFzWnn8NqV5/HJJ9oUMBZUDcJ6TOEwh8t NRH0//rnuCTGbwfflX4nyQ9TAyEChL8fJYktZpC62BPZuuVOZ4Z0IjC1kfSc4Rjx3HTf vpC7L+euGEiF8Ik2FqIIRtMKXYnucaThAAAfr8nI5GKGhB7BqnkiOSGxI+knq3JioWgl 8FB0rUt9rnvJ6mmilyP/L5Wnp4GU09wTXvwrwQuN8oS2oDm+/CgXJO678Iimj5s4kmAP Wg== Received: from ppma06fra.de.ibm.com (48.49.7a9f.ip4.static.sl-reverse.com [159.122.73.72]) by mx0a-001b2d01.pphosted.com with ESMTP id 3836gy9ju2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 22 Apr 2021 06:23:47 -0400 Received: from pps.filterd (ppma06fra.de.ibm.com [127.0.0.1]) by ppma06fra.de.ibm.com (8.16.0.43/8.16.0.43) with SMTP id 13MALrNn013067; Thu, 22 Apr 2021 10:23:45 GMT Received: from b06cxnps3074.portsmouth.uk.ibm.com (d06relay09.portsmouth.uk.ibm.com [9.149.109.194]) by ppma06fra.de.ibm.com with ESMTP id 37ypxh9j0f-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 22 Apr 2021 10:23:44 +0000 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 13MANgSp24052128 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 22 Apr 2021 10:23:42 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9900BAE051; Thu, 22 Apr 2021 10:23:42 +0000 (GMT) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7D3CDAE045; Thu, 22 Apr 2021 10:23:39 +0000 (GMT) Received: from saptagiri.in.ibm.com (unknown [9.199.63.107]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 22 Apr 2021 10:23:39 +0000 (GMT) From: Srikar Dronamraju To: Ingo Molnar , Peter Zijlstra Cc: LKML , Mel Gorman , Rik van Riel , Srikar Dronamraju , Thomas Gleixner , Valentin Schneider , Vincent Guittot , Dietmar Eggemann , Gautham R Shenoy , Parth Shah Subject: [PATCH 01/10] sched/fair: Update affine statistics when needed Date: Thu, 22 Apr 2021 15:53:17 +0530 Message-Id: <20210422102326.35889-2-srikar@linux.vnet.ibm.com> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20210422102326.35889-1-srikar@linux.vnet.ibm.com> References: <20210422102326.35889-1-srikar@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: FlELXYSdsq62faEzySQO9UCnEJy82BSz X-Proofpoint-GUID: FlELXYSdsq62faEzySQO9UCnEJy82BSz X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391,18.0.761 definitions=2021-04-22_04:2021-04-21,2021-04-22 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 mlxscore=0 phishscore=0 malwarescore=0 priorityscore=1501 adultscore=0 suspectscore=0 mlxlogscore=948 spamscore=0 bulkscore=0 impostorscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104060000 definitions=main-2104220084 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. 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)) { + schedstat_inc(sd->ttwu_move_affine); + schedstat_inc(p->se.statistics.nr_wakeups_affine); + } return target; } -- 2.18.2