From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailgw2.hygon.cn (unknown [101.204.27.37]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3270D2D4B4B for ; Thu, 27 Nov 2025 09:44:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=101.204.27.37 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764236660; cv=none; b=Ywtdm8k/uMvUk96B7a7JEHCrpu8mXLbhcM5wTSJhvw156dF+tqBCwQReY3cta8uRq32qh4QZ/vxRMftbK+3dREUabVPyufBkNHwPq6HMuJ45UGdBhVqRjgRWVSYX8Ty7N5BQBTF9BT3PtkWRzqflfQ+M3vy3Biv83+oejKPF1Ec= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764236660; c=relaxed/simple; bh=7NBYbg5toabTgZYDvP9zO4soiC2SwKYphPi0Jvvqsu8=; h=From:To:CC:Subject:Date:Message-ID:References:In-Reply-To: Content-Type:MIME-Version; b=KebsSdRS/D9JXJtswKCCnaCaKSWzo0WjO3My7vr4e3jrcOMWrn69uWdDwGXZTy1nqfab0Eiw20rXJo4gwc4ACpaCV831n9NkKw36YexeTKhO0/u8eJ5rRt56SahwREL0kschuErXZ2+aBrU3wN55uQ/ojo4njoEr0Q38I2fevM0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=hygon.cn; spf=pass smtp.mailfrom=hygon.cn; arc=none smtp.client-ip=101.204.27.37 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=hygon.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=hygon.cn Received: from maildlp2.hygon.cn (unknown [127.0.0.1]) by mailgw2.hygon.cn (Postfix) with ESMTP id 4dHBMX5R6Pz1YQpmN; Thu, 27 Nov 2025 17:43:52 +0800 (CST) Received: from maildlp2.hygon.cn (unknown [172.23.18.61]) by mailgw2.hygon.cn (Postfix) with ESMTP id 4dHBMX4dtcz1YQpmN; Thu, 27 Nov 2025 17:43:52 +0800 (CST) Received: from cncheex04.Hygon.cn (unknown [172.23.18.114]) by maildlp2.hygon.cn (Postfix) with ESMTPS id E3A6034C9AC5; Thu, 27 Nov 2025 17:39:53 +0800 (CST) Received: from cncheex04.Hygon.cn (172.23.18.114) by cncheex04.Hygon.cn (172.23.18.114) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.27; Thu, 27 Nov 2025 17:43:52 +0800 Received: from cncheex04.Hygon.cn ([fe80::1b6f:6c58:58a4:430d]) by cncheex04.Hygon.cn ([fe80::1b6f:6c58:58a4:430d%10]) with mapi id 15.02.1544.027; Thu, 27 Nov 2025 17:43:52 +0800 From: Jianyong Wu To: Peter Zijlstra CC: "mingo@redhat.com" , "juri.lelli@redhat.com" , "vincent.guittot@linaro.org" , "dietmar.eggemann@arm.com" , "rostedt@goodmis.org" , "bsegall@google.com" , "mgorman@suse.de" , "vschneid@redhat.com" , "linux-kernel@vger.kernel.org" , "jianyong.wu@outlook.com" , Yibin Liu Subject: RE: [PATCH] sched/core: avoid calling select_task_rq if bound to one CPU for exec Thread-Topic: [PATCH] sched/core: avoid calling select_task_rq if bound to one CPU for exec Thread-Index: AQHcXrO60EBKSZ1o3kGZamJveQHQbLUFrNuAgACM4jA= Date: Thu, 27 Nov 2025 09:43:52 +0000 Message-ID: <369e570a88114183ae48c918c0f500f6@hygon.cn> References: <20251126090401.59698-1-wujianyong@hygon.cn> <20251127083111.GY3245006@noisy.programming.kicks-ass.net> In-Reply-To: <20251127083111.GY3245006@noisy.programming.kicks-ass.net> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Hi Peter, Thanks for reply. > -----Original Message----- > From: Peter Zijlstra > Sent: Thursday, November 27, 2025 4:31 PM > To: Jianyong Wu > Cc: mingo@redhat.com; juri.lelli@redhat.com; vincent.guittot@linaro.org; > dietmar.eggemann@arm.com; rostedt@goodmis.org; bsegall@google.com; > mgorman@suse.de; vschneid@redhat.com; linux-kernel@vger.kernel.org; > jianyong.wu@outlook.com; Yibin Liu > Subject: Re: [PATCH] sched/core: avoid calling select_task_rq if bound to= one > CPU for exec >=20 > On Wed, Nov 26, 2025 at 05:04:01PM +0800, Jianyong Wu wrote: >=20 > > kernel/sched/core.c | 6 +++++- > > 1 file changed, 5 insertions(+), 1 deletion(-) > > > > diff --git a/kernel/sched/core.c b/kernel/sched/core.c index > > f754a60de848..c1e9f633cfb0 100644 > > --- a/kernel/sched/core.c > > +++ b/kernel/sched/core.c > > @@ -5442,7 +5442,11 @@ void sched_exec(void) > > int dest_cpu; > > > > scoped_guard (raw_spinlock_irqsave, &p->pi_lock) { > > - dest_cpu =3D p->sched_class->select_task_rq(p, task_cpu(p), WF_EXEC)= ; > > + if (p->nr_cpus_allowed > 1 && !is_migration_disabled(p)) > > + dest_cpu =3D p->sched_class->select_task_rq(p, task_cpu(p), > WF_EXEC); > > + else > > + dest_cpu =3D cpumask_any(p->cpus_ptr); > > + >=20 > Instead of duplicating this, could we not just call select_task_rq() here= ? Do you mean using select_task_rq() instead of making these changes? I think= that works. I'll make this change in the next version. Thanks Jianyong