From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=52.26.1.71 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796304593; b=Y7UBNEOS0aZ2h467q4bcnJgzWP6qdEXYG7vgxCBMx5V06puElbIZr+bzUvopz/IQCsoF sLzSGBzpxmPZdKsb5ZTZoNUQflz1IE990UIsAGxxzafE4+YCmhLFu+yW4QP+5yBLXL3Ws ZmGkQk0nd9cAPLBu5lFvPU0zjnzGrf/K6255Tspmn2APgQfIqCO/FuOMJaMvRB5yyrKyN gKq/S+wCf5YCXIm+vSvAx0U9hDOBe+5iwsouj/csRkC9Lrubwme7BKkyL9KRllllXrIF4 /jW+pSVnyGn+xfDl89p5mOi/v38xLKht7CU7I69c+2maRC3lknXLCmFXTCKX10I7P1Q== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796304593; h=DMARC-Filter:DKIM-Signature:X-CSE-ConnectionGUID:X-CSE-MsgGUID: X-IronPort-AV:Received:Received:X-Farcaster-Flow-ID:Received:Received: From:To:CC:Subject:Date:Message-ID:X-Mailer:In-Reply-To:References: MIME-Version:Content-Transfer-Encoding:Content-Type:X-Originating-IP: X-ClientProxiedBy; bh=xrGDIgva5R63m8XK/fU4iSoA9nIC+U/h+vRmr8HgN9o=; b=kvxU92FLwFyw0JETRKBQPEb8VQ/QYSlno5gkSpznxDrEHxwc3dBUqdgKMLU1T7oiNhoj tJTYc1OPmavz8vqaI9kyWYhnEzwc6ab38X68ONNmYfugwY0wxAQ34fKKr7dgU3BvSk4kd 2EZBTd9afK2qdO8Notp4b0TkwFbJ4DAUTVG7EhT/JYwKgagX2k2v4sp4O1xNsbTP1vZvV 383NieaDWSArz5i20IDWiQO1dFdp+i0AJHn4VOPn0bVbTSMSkXRiysbVo3gL+MHkDpgox rVIV4dIJ3qdH+ICjnpD4Iy3v0Rjfyk1LUjWJOVt50+PTGox14O4My//1fisJByZDtMQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=amazon.de; spf=pass smtp.mailfrom=amazon.de; dkim=pass header.d=amazon.de header.i=@amazon.de header.a=rsa-sha256 header.s=amazoncorp2 header.b=TLVbowXF; arc=none smtp.remote-ip=52.26.1.71 Received: from pdx-out-006.esa.us-west-2.outbound.mail-perimeter.amazon.com (pdx-out-006.esa.us-west-2.outbound.mail-perimeter.amazon.com [52.26.1.71]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D70D1606A322; Thu, 3 Dec 2026 13:29:49 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org D70D1606A322 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amazon.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=amazon.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=amazon.de header.i=@amazon.de header.a=rsa-sha256 header.s=amazoncorp2 header.b=TLVbowXF DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.de; i=@amazon.de; q=dns/txt; s=amazoncorp2; t=1796304589; x=1827840589; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=xrGDIgva5R63m8XK/fU4iSoA9nIC+U/h+vRmr8HgN9o=; b=TLVbowXFd6AmJ86nCM4Qf4wVSq2jl+DsWj96ImEBcZyCxKhGJ2uuMVxZ AGwnlMrsmDjemhzEDaKztUT7SRJV2jqlpiz0ixlQsk/ZrdoLxTxfXuDUO o/8ZOYZ8YS4Q96MFzGMqJ0Qgai5nVbw9oMBQeb31WZU36tc8qXEhYSSxq Mvgxtf/XHrToAVv1u7CYOwhfcUyozjdnTcbxF1te56hxemVHg7BAZ0a9g bh3ufDVZkuYc1AD4T6jvbwWBO/wCxmF+RU1GvKwPBL/y2kSoQPDTjEdc7 rFDVIlIy0R2cIMCfjwHBDS1reeLq9uDF58dv2l3yHSuU7TtchIlqYIdXM A==; X-CSE-ConnectionGUID: D5OTCfF1RL+F0+DwhgQ+0w== X-CSE-MsgGUID: xJeNoYAZSj6Ulsqcjw1N+g== X-IronPort-AV: E=Sophos;i="6.29,248,1794873600"; d="scan'208";a="35881134" Received: from ip-10-5-12-219.us-west-2.compute.internal (HELO smtpout.naws.us-west-2.prod.farcaster.email.amazon.dev) ([10.5.12.219]) by internal-pdx-out-006.esa.us-west-2.outbound.mail-perimeter.amazon.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Dec 2026 13:29:45 +0000 Received: from EX19MTAUWA001.ant.amazon.com [205.251.233.182:21009] by smtpin.naws.us-west-2.prod.farcaster.email.amazon.dev [10.0.42.230:2525] with esmtp (Farcaster) id eb43ba60-7dad-4d2c-a417-8c1af35116e8; Thu, 3 Dec 2026 13:29:44 +0000 (UTC) X-Farcaster-Flow-ID: eb43ba60-7dad-4d2c-a417-8c1af35116e8 Received: from EX19D001UWA001.ant.amazon.com (10.13.138.214) by EX19MTAUWA001.ant.amazon.com (10.250.64.217) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA) id 15.2.2562.57; Thu, 3 Dec 2026 13:29:44 +0000 Received: from dev-dsk-araoof-1b-23e02486.eu-west-1.amazon.com (10.253.65.187) by EX19D001UWA001.ant.amazon.com (10.13.138.214) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA) id 15.2.2562.57; Thu, 3 Dec 2026 13:29:42 +0000 From: Ahmed Abdelraoof To: Peter Zijlstra CC: Ingo Molnar , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Valentin Schneider , K Prateek Nayak , "Vineeth Pillai (Microsoft)" , Josh Don , , Subject: Re: [PATCH] sched/core: keep offline cpus out of core-wide selections Date: Thu, 3 Dec 2026 13:29:35 +0000 Message-ID: <20261203132936.146998-1-araoof@amazon.de> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20261102130728.GI1813469@noisy.programming.kicks-ass.net> References: <20261102130728.GI1813469@noisy.programming.kicks-ass.net> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: EX19D031UWA004.ant.amazon.com (10.13.139.19) To EX19D001UWA001.ant.amazon.com (10.13.138.214) On Mon, 2 Nov 2026 14:07:28 +0100, Peter Zijlstra wrote: > On Sun, Nov 01, 2026 at 10:12:18PM +0000, Ahmed Abdelraoof wrote: > > > kernel/sched/core.c | 12 ++++++++++++ > > kernel/sched/core_sched.c | 2 +- > > 2 files changed, 13 insertions(+), 1 deletion(-) > > > > diff --git a/kernel/sched/core.c b/kernel/sched/core.c > > index d7c3b43158de..f55f6a0befcc 100644 > > --- a/kernel/sched/core.c > > +++ b/kernel/sched/core.c > > @@ -6413,6 +6413,9 @@ pick_next_task(struct rq *rq, struct rq_flags *rf) > > */ > > max = NULL; > > for_each_cpu_wrap(i, smt_mask, cpu) { > > + if (!cpu_online(i)) > > + continue; > > + > > rq_i = cpu_rq(i); > > > > /* > > @@ -6448,6 +6451,8 @@ pick_next_task(struct rq *rq, struct rq_flags *rf) > > for_each_cpu(i, smt_mask) { > > rq_i = cpu_rq(i); > > p = rq_i->core_pick; > > + if (!p) > > + continue; > > Can't you do what you do in the last hunk for all 3 cases? It seems > unfortunate to have 3 different ways to iterate in one patch. > For the first case, I think we can but I am not sure it is a good idea. We do not have for_each_cpu_wrap_and(), so we would need to create it. At the same time, the patch targets stable@. For the second case, I do not think it will work. When onlining a new CPU, there is a short window where the CPU is online but its task pointer is still NULL leading to crash. Doing things in the opposite order (set task pointer first and then online) would lead to cases where the CPU can run tasks, but the group leader does not see it? At least that is my intuition. Let me know what you think. Cheers, Ahmed.