From patchwork Thu Apr 6 10:05:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tip-bot2 for Thomas Gleixner X-Patchwork-Id: 80176 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp914735vqo; Thu, 6 Apr 2023 03:25:33 -0700 (PDT) X-Google-Smtp-Source: AKy350a8W/XOiMvszzXXb5QNzhH044gu7aadyLeUJUxGBfNHgKdOuLteHNTrcNDMfDYyl5Iwo35T X-Received: by 2002:a17:906:3f86:b0:929:e5a8:63f7 with SMTP id b6-20020a1709063f8600b00929e5a863f7mr4576883ejj.28.1680776733202; Thu, 06 Apr 2023 03:25:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680776733; cv=none; d=google.com; s=arc-20160816; b=oahxEGRss2h4OR80AEPVnYDS4Fflcn10eULtYVaq+iAeQn1x2Wfb5iOd2Q6D0hvwO1 DzmU8kFqaNnw7VMA7mByC/x/vWzusD6eUPZ6FHbDFfcEZxj48mbBxcrxVTdijVgkfoMG mIBcEtDkFawAYllrESp4PET1zv246CknMASR1XIMnLgSpvX8rJsKLbMe+woWwYZqO7C7 orfugZL5QRMaQYylUEymnBnfsGtHfOEL93LMjMf1S31L2JV2pQbQ3YP78AtIruqN+6uy I58+XdKYVYT7Z3Y11ZMOy4cy+1CykZ5b1fieqpMNkb70+wuBuAfdhR2xu/j8StQ6vLNj 0u3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=RtBwv407r3SAF6Swovvpje9RF/5WDCm8wYaw2CnX4Sc=; b=WUClLYLUaDHUu6QtFVFz4n76opISRsVa2JhTIXodPVuHL8lHLh43hERqBpcNNtJS8v gwz08ILer3JNCo64rsLKLhylHo4XocuJum4INZ1Db9567P89kjhAnoj/0IJWTsIcqzEC yscbuUO0da1pW9NVO6hdbAOVLrY6kSzzy2YsR9TACBDYofUDh2Y5H/goes/AIICwdhPK bmTuPemOC0AICqsb8a9HWW2kpN3heOxceFXLNcRa2jTbS7ziMKJdywA45MuDp63P5mzR AQvwLBTnMZk3oK0ag/pm3InatsNtJowYMKywZIb08BJl5INP56fk2e1nMUeIfcHCtu3A lIGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=ZdX2rvYe; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s22-20020a17090699d600b00933d2299f06si1068858ejn.432.2023.04.06.03.25.08; Thu, 06 Apr 2023 03:25:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=ZdX2rvYe; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237148AbjDFKGF (ORCPT + 99 others); Thu, 6 Apr 2023 06:06:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59798 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236645AbjDFKFW (ORCPT ); Thu, 6 Apr 2023 06:05:22 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3A23B5FCF; Thu, 6 Apr 2023 03:05:21 -0700 (PDT) Date: Thu, 06 Apr 2023 10:05:19 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1680775519; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=RtBwv407r3SAF6Swovvpje9RF/5WDCm8wYaw2CnX4Sc=; b=ZdX2rvYe3ClPSQAb8kALWpLgrxSKUFNS8S6fbkhmGB217LowdRgPgx4bHFbb6k3l93ti5h NOVhy50nZ510upWaiSptUatUXY0OIw4PpJ60ZhHuURetMtATYwIveOf5iP/VSkZyERZS3m 6ZYrdQFjFu6cfkkPb6vmfLe3neJbRIm1b7EyvScqy0J4VBxvrUgUW7gv+qEZgq7TTVVgW0 AJ+kv2U5Xcb9S7iGPO1gSu+oeY4ZaJe0kzwfQs/J49Z8pYsMfw0TY3Xo2OQdoe1Dpr5o54 C27I3XhyCo9WefbUnjFVKgJjbn2jfAQ3zSObSN5ixlCMl8CfrE1ZaOdxgU2QFg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1680775519; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=RtBwv407r3SAF6Swovvpje9RF/5WDCm8wYaw2CnX4Sc=; b=crAfDN44zbMVh3jCuDRfhfAfgkuERL7EdJk0z9fOi1bfNEAHJtudV1451+Dhm32dGGzADj HnRwx2qQncrnhYBg== From: "tip-bot2 for Libo Chen" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: sched/core] sched/fair: Fix inaccurate tally of ttwu_move_affine Cc: Daniel Jordan , Libo Chen , "Peter Zijlstra (Intel)" , "Gautham R. Shenoy" , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20220810223313.386614-1-libo.chen@oracle.com> References: <20220810223313.386614-1-libo.chen@oracle.com> MIME-Version: 1.0 Message-ID: <168077551915.404.18277041961422238219.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails X-Spam-Status: No, score=-2.5 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754584394609600091?= X-GMAIL-MSGID: =?utf-8?q?1762422144168864783?= The following commit has been merged into the sched/core branch of tip: Commit-ID: 39afe5d6fc59237ff7738bf3ede5a8856822d59d Gitweb: https://git.kernel.org/tip/39afe5d6fc59237ff7738bf3ede5a8856822d59d Author: Libo Chen AuthorDate: Wed, 10 Aug 2022 15:33:13 -07:00 Committer: Peter Zijlstra CommitterDate: Wed, 05 Apr 2023 09:58:48 +02:00 sched/fair: Fix inaccurate tally of ttwu_move_affine 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 Signed-off-by: Libo Chen Signed-off-by: Peter Zijlstra (Intel) Reviewed-by: Gautham R. Shenoy Link: https://lore.kernel.org/r/20220810223313.386614-1-libo.chen@oracle.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 bc358dc..f5da01a 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -6582,7 +6582,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);