From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DE45A2356A4 for ; Thu, 27 Nov 2025 08:31:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764232286; cv=none; b=EVh/6lF08JEUkaTeWCSn8Xr63fAv4BX5i82LxRWzPj622gP8Th9RHEekC/SMr3LwdHxrPf/CM2jo9tpWDGRrnxIrMnjRzjeVJo+whno5RlMKkth/IgDm49E3/APToLcxQsKmtGS9/iuEom9lh9IEly0b0UBFX3KhFcOz/MKOv3c= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764232286; c=relaxed/simple; bh=EVBmO1EAcN006JwSTcfAgAMw7jGoZK0X26ztnMfdLWU=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=M1i7ccBt/klSVz92DD+4UfiV9/nh6NDCiim7SyeUXe2MxDdS43wUCWhCQP42YJvX9BnDI+3uKjcyrR1nbpPO7YzqXvzvJwycJhMYH7nDp7Iy+98rt+MoXgzj3JaTRiz1zHd3xZ8GzDxjEPOmiZj48JX7ZKx3hijiqmaOuud4f90= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=PvrVnCCz; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="PvrVnCCz" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=Irk/lBfLEUgEyJln3kKZwoEkAomddDVECC0c5od4bb8=; b=PvrVnCCz1NEub9M+MVv2Ex/v/u yZazVe5dOwg2CFFya/FZSt9QW0prQ2aSVY7q8NUhyvyVwRU8KByuqxW5ZRfwJnyGRbodjI3NYjpFg 56dP/m2aDR2BVCZpW02oBvDZ+INEqWvToEAylD1UST+0MGBi6jUL+FrrFzcMTXJzwEyu5HYLPOsWv F/9I38YjqKVGe/evXkFqxmMYjPV6U+c4IvZhAHXQqqrebaCpg01NZJvGcKaM7sDM6aPdnx3J8WizR Cs0/Fm32bE0lYddwY57qYt+I5VUtYJqjpCJA820aGQ8jEMktM4UMSLyEs6mAecbPN4tCtlPmThQWa baVNxMkQ==; Received: from 77-249-17-252.cable.dynamic.v4.ziggo.nl ([77.249.17.252] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.98.2 #2 (Red Hat Linux)) id 1vOXPF-0000000BRHc-0uFN; Thu, 27 Nov 2025 08:31:13 +0000 Received: by noisy.programming.kicks-ass.net (Postfix, from userid 1000) id C3988300413; Thu, 27 Nov 2025 09:31:11 +0100 (CET) Date: Thu, 27 Nov 2025 09:31:11 +0100 From: Peter Zijlstra 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, liuyibin@hygon.cn Subject: Re: [PATCH] sched/core: avoid calling select_task_rq if bound to one CPU for exec Message-ID: <20251127083111.GY3245006@noisy.programming.kicks-ass.net> References: <20251126090401.59698-1-wujianyong@hygon.cn> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20251126090401.59698-1-wujianyong@hygon.cn> On Wed, Nov 26, 2025 at 05:04:01PM +0800, Jianyong Wu wrote: > 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 = p->sched_class->select_task_rq(p, task_cpu(p), WF_EXEC); > + if (p->nr_cpus_allowed > 1 && !is_migration_disabled(p)) > + dest_cpu = p->sched_class->select_task_rq(p, task_cpu(p), WF_EXEC); > + else > + dest_cpu = cpumask_any(p->cpus_ptr); > + Instead of duplicating this, could we not just call select_task_rq() here?