Received: by 2002:a05:6520:4211:b029:f4:110d:56bc with SMTP id o17csp1602958lkv; Thu, 6 May 2021 09:47:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwxbAtREHVjmZZcQ59S1OVL+v5y7AFdKp0kfuanUM+uihvXL3DKrA9CuE8LCfu0O1b15Ulm X-Received: by 2002:aa7:d90d:: with SMTP id a13mr6284990edr.76.1620319664045; Thu, 06 May 2021 09:47:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620319664; cv=none; d=google.com; s=arc-20160816; b=DAM0QLdF9k1ufTmiTt4RSJ3l713x+yqj29NLH39uqCPUbbKpUKWP4o8xfk/Oo2OaIr kFoeIyHVPcGsIss4t8lNxuYc0AQ4SVmw6CrA9dssEiqSiPKg/j4ngTLaH1jB2sGSX0bO kSCWYPhx7JqFRP2WxfSRHJie2ZCEgp598TyAAgOoSN1xaAMF1/EhtBZapRA+zRM0uOEe Prs7HH94fslkcIgkhvUVF7HSAhwJO+LMr3Pvfhd/tUdK6KAdjQMZ47uhvSpx1i5OmQ1p naJIDRTkaN2SHlsh2PWvBL9nqdN4hmUV1kw57hiGBG4Y2Iqz4vye3bQO2YxJYz2B/q8C U8FA== 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=RkKQ8VyUVuyo+jK3qc7kAR/6W4gcqLlwkozWFQcabPbk4Ki4fqdnTXa563HuC2VjvB IWxj2Q1367I4UYnhIKW2pZRs4Dm1zMXuc/S3tld/7drDPFLf+jCSNJHxmsswmOx6yAbo 6EseprPoVXd1iNhCBcfgJ2RyJTJOxt/W7LLaQH3PUEAMUUJsWMZ71C04PQxgJXPGZpKp pZ5boADY0cFs2FUu3FWKaqE73fdfC7vi8vurOatVoTb0Z8qk0KitW8+GtJ8rAo5c2rU9 fLvHyR1PBhB3cn3+aWCL3oFCk/Jd5+9yurUiQ5miaK7rHU/esF3bQ/UVIM7edlxU14O5 scEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b="N65Mv/eu"; 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 z15si2913312edc.219.2021.05.06.09.47.18; Thu, 06 May 2021 09:47:44 -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="N65Mv/eu"; 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 S236058AbhEFQrS (ORCPT + 99 others); Thu, 6 May 2021 12:47:18 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:27632 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236021AbhEFQrR (ORCPT ); Thu, 6 May 2021 12:47:17 -0400 Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 146GXRW3019844; Thu, 6 May 2021 12:45:57 -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=N65Mv/euUeo9Astj9/3IV4s0eAMJzeQMTLAunWqFK09+0Mc86MmsRvmXpTGJGKdQwFDv YXcb9JTCC5q1D6wdDluDLKmqtchpcn9Ou28AwYBhHLY1wONdDOk8KDbVHosERSxcIIXN Q8kDROusoY0yvrl7z6MbfrnPTsWoVDRs0bRj7bnHWA6L8C+iKYkpJdtCRnYft1wUik6n G3JpJpyL/WLKabSiUe+JkbdFVfOL7LkeBuzx7pLVZGFtBtf6um/uEbAICr9X08kC97IM tMVSsHafL7vR17xteFo23lik8p5TZyk+TTv39+tDLGdmEgyAezMyTi1CTvQQ3+8J5JDP 7g== Received: from ppma03ams.nl.ibm.com (62.31.33a9.ip4.static.sl-reverse.com [169.51.49.98]) by mx0a-001b2d01.pphosted.com with ESMTP id 38cm2ggbyg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 06 May 2021 12:45:57 -0400 Received: from pps.filterd (ppma03ams.nl.ibm.com [127.0.0.1]) by ppma03ams.nl.ibm.com (8.16.0.43/8.16.0.43) with SMTP id 146GgFpn025936; Thu, 6 May 2021 16:45:55 GMT Received: from b06cxnps3074.portsmouth.uk.ibm.com (d06relay09.portsmouth.uk.ibm.com [9.149.109.194]) by ppma03ams.nl.ibm.com with ESMTP id 38cfrqr818-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 06 May 2021 16:45:55 +0000 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 146GjrGA23920908 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 6 May 2021 16:45:53 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id EEAC4A4057; Thu, 6 May 2021 16:45:52 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9A79CA404D; Thu, 6 May 2021 16:45:50 +0000 (GMT) Received: from saptagiri.in.ibm.com (unknown [9.77.204.81]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 6 May 2021 16:45:50 +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 v2 1/8] sched/fair: Update affine statistics when needed Date: Thu, 6 May 2021 22:15:36 +0530 Message-Id: <20210506164543.90688-2-srikar@linux.vnet.ibm.com> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20210506164543.90688-1-srikar@linux.vnet.ibm.com> References: <20210506164543.90688-1-srikar@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-GUID: PosuLvvzueVGd1JOp69FSXr8_8b0LoIZ X-Proofpoint-ORIG-GUID: PosuLvvzueVGd1JOp69FSXr8_8b0LoIZ X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391,18.0.761 definitions=2021-05-06_10:2021-05-06,2021-05-06 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 bulkscore=0 adultscore=0 clxscore=1015 mlxlogscore=935 phishscore=0 lowpriorityscore=0 malwarescore=0 priorityscore=1501 impostorscore=0 suspectscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104060000 definitions=main-2105060114 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