From patchwork Mon Oct 17 14:45:47 2022 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: 3488 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp1492226wrs; Mon, 17 Oct 2022 07:53:53 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6zMW3B9ZDGDYBZd0vmPF4PB8Qp0vvhkWN9DKW/y11xxj3aoLOalHULT+Sapa0UNvgSzSFr X-Received: by 2002:aa7:db4d:0:b0:458:908f:a372 with SMTP id n13-20020aa7db4d000000b00458908fa372mr10630434edt.248.1666018432790; Mon, 17 Oct 2022 07:53:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666018432; cv=none; d=google.com; s=arc-20160816; b=f5npmV8BUpg1ygDASyPi951IwxzVAbxwfHuAbeWJEbmT1SO+4c+AjYiSE6LLTuYiuP S3WpHxwS1cVEvSGHDQYbGFBYRG7RZWnO3Xi8eiUWOaVNQwYCd3iop58luIj/jnHkHqCe 0+7CjbG6Y1T7tQooQTRRYzTB/kcc+OvD0WZN1ggF+M4AzfHqs0yhFgevPYApLAqDoIHy NySQZFiQ9mP7tu9RMg99AmX4Pyp/s41pIMg72493pllBy1MAsAN4aY5aZ4vzqz99jJUd nT90Rh2wbu2D4Hj+MtSfnn8t4iKIRg9+VVusPuD9GdKnJayGXuVyvNIbPcEPo7li97tq v3Pg== 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=FUiSU7bA5nGiiF57G7D3vhxso7yviXcr1ZoOAiG495U=; b=JugnPW+5OQ7xIG8vaGe2WH4mTbumP547Vs3C5GO1lfH0RZY/cBHmivl7b/C+pwuj11 O80/NwG2rXe0burnmi/JXFZqmPpDKrx0i5q2aiJ8zjlCccJMptdaVZZwEILNiou+dofo aU7VE+extWbYkkr0mjFwsF10MmUu+evsT4Z1sNxZg/hVjPxZMRYXuSaK6m84WgZvK9UO wfdpesPMtoa2G+GkHPMmMOcqUKekgzw6YYOTYU7/Zzn31SaTLAzkGvRscA7LH8BM15gv Z8x4z0qkubGiBoI7H8WaycSbZpnxd/ssrtPo7hfw62g89EJ3ZtSHf0NTk+pJh+Mz+RwV NJ5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=Pmeaz3CX; dkim=neutral (no key) header.i=@linutronix.de; 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 go37-20020a1709070da500b0078356aaeb61si9799190ejc.286.2022.10.17.07.53.27; Mon, 17 Oct 2022 07:53:52 -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=Pmeaz3CX; dkim=neutral (no key) header.i=@linutronix.de; 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 S231159AbiJQOqM (ORCPT + 99 others); Mon, 17 Oct 2022 10:46:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40666 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231157AbiJQOqC (ORCPT ); Mon, 17 Oct 2022 10:46:02 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A1AE96717C; Mon, 17 Oct 2022 07:45:50 -0700 (PDT) Date: Mon, 17 Oct 2022 14:45:47 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1666017948; 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=FUiSU7bA5nGiiF57G7D3vhxso7yviXcr1ZoOAiG495U=; b=Pmeaz3CXRLYaPWeCmhhCt8CLvIlDmkOnKbiChGuY9aZSGGNl93PmGGX8fkwb2jQYULoDT0 KqJhN/fKxg3QEn0IkhFMcK9ruzkM894X8SlwAYlXGWIIwXOpEORGfwtlcG2nGdz/hhVqpk OSJ6NIFbQqRdg1MnUm6uQQaNFrWDMoeFNb0rIDoMLOGrXz2NDOAg5jjr9fsewixtr6tgTU ZB1HJg+yhvmydP0fmKF2hBpm7TJ8SJr8PIEYLgjeZ7Bd7K8e0BEAjEMPFjdvsp4SWjsJPz fnrEZAje/M7zuFwSUVqLGuGFwxihrwf8AAMqweCJurBKC7EHi751EH/oOZqlDw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1666017948; 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=FUiSU7bA5nGiiF57G7D3vhxso7yviXcr1ZoOAiG495U=; b=E9taiW2J7tFnvXMAHWWgnZGLRZGiOxVNYWQzIv1wQ2OKHHMVYW0KMm7Kjgfil7SLWOpMjJ e98lOI58z8+dppBQ== From: "tip-bot2 for Lin Shengwang" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: sched/urgent] sched/core: Fix comparison in sched_group_cookie_match() Cc: Lin Shengwang , "Peter Zijlstra (Intel)" , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20221008022709.642-1-linshengwang1@huawei.com> References: <20221008022709.642-1-linshengwang1@huawei.com> MIME-Version: 1.0 Message-ID: <166601794728.401.12715574315291898146.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS autolearn=ham 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?1746946944078345250?= X-GMAIL-MSGID: =?utf-8?q?1746946944078345250?= The following commit has been merged into the sched/urgent branch of tip: Commit-ID: e705968dd687574b6ca3ebe772683d5642759132 Gitweb: https://git.kernel.org/tip/e705968dd687574b6ca3ebe772683d5642759132 Author: Lin Shengwang AuthorDate: Sat, 08 Oct 2022 10:27:09 +08:00 Committer: Peter Zijlstra CommitterDate: Mon, 17 Oct 2022 16:41:24 +02:00 sched/core: Fix comparison in sched_group_cookie_match() In commit 97886d9dcd86 ("sched: Migration changes for core scheduling"), sched_group_cookie_match() was added to help determine if a cookie matches the core state. However, while it iterates the SMT group, it fails to actually use the RQ for each of the CPUs iterated, use cpu_rq(cpu) instead of rq to fix things. Fixes: 97886d9dcd86 ("sched: Migration changes for core scheduling") Signed-off-by: Lin Shengwang Signed-off-by: Peter Zijlstra (Intel) Link: https://lkml.kernel.org/r/20221008022709.642-1-linshengwang1@huawei.com --- kernel/sched/sched.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h index 1644242..0d08511 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h @@ -1182,6 +1182,14 @@ static inline bool is_migration_disabled(struct task_struct *p) #endif } +DECLARE_PER_CPU_SHARED_ALIGNED(struct rq, runqueues); + +#define cpu_rq(cpu) (&per_cpu(runqueues, (cpu))) +#define this_rq() this_cpu_ptr(&runqueues) +#define task_rq(p) cpu_rq(task_cpu(p)) +#define cpu_curr(cpu) (cpu_rq(cpu)->curr) +#define raw_rq() raw_cpu_ptr(&runqueues) + struct sched_group; #ifdef CONFIG_SCHED_CORE static inline struct cpumask *sched_group_span(struct sched_group *sg); @@ -1269,7 +1277,7 @@ static inline bool sched_group_cookie_match(struct rq *rq, return true; for_each_cpu_and(cpu, sched_group_span(group), p->cpus_ptr) { - if (sched_core_cookie_match(rq, p)) + if (sched_core_cookie_match(cpu_rq(cpu), p)) return true; } return false; @@ -1384,14 +1392,6 @@ static inline void update_idle_core(struct rq *rq) static inline void update_idle_core(struct rq *rq) { } #endif -DECLARE_PER_CPU_SHARED_ALIGNED(struct rq, runqueues); - -#define cpu_rq(cpu) (&per_cpu(runqueues, (cpu))) -#define this_rq() this_cpu_ptr(&runqueues) -#define task_rq(p) cpu_rq(task_cpu(p)) -#define cpu_curr(cpu) (cpu_rq(cpu)->curr) -#define raw_rq() raw_cpu_ptr(&runqueues) - #ifdef CONFIG_FAIR_GROUP_SCHED static inline struct task_struct *task_of(struct sched_entity *se) {