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 7B63A352F86 for ; Fri, 23 Jan 2026 10:04:33 +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=1769162677; cv=none; b=NflLx7oXPq4VHvn93Bk+wt7Ma/GFr4c5vX6HEznz6XReV8KIXDSLVSuQJHw4/zLwcI54mMPNb5bURNYQpq6UP+U4t17kf3XLTtZKY6Q3QvQrP9lyyDxj7o3cYe5f3wOGPQz89QYCVIfuC6Acp/Wyq1tFOY7vaeFYiu01fGVo9NA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769162677; c=relaxed/simple; bh=vxVBl4D/ZOGRlj8tCckpBZ91eZGJy8qrUmGcKb3y+BI=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=nRT8IEbBuaXKNcQOOxAT6DHsEOqv3gQZFuSkucSQ2bGd9w3S+bM5QVFGkepksz8sVj5/dt0ZbBrLZwlOCRn1hQGXyGJ3AuNKfucAanr83PKiE51bFmty74cJ2aZZYMU93dnSZ0Kggm9IFUEF97aSjjYp3tGB0O7jdYxzTv9zzhs= 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=tcH9rkjf; 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="tcH9rkjf" 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=ICea0BsiR5fx3QmIqBRasmBbkbYHxXNTs71A6nXfw/Q=; b=tcH9rkjfwp8YmdlsGCB8X1Hw8c uQMSDWbDaGE7BteloUiWCz3pZTPhD92AlMpftap3UCCmFzIjUyBmAL0l0u/eveofHgiLC489MjICY 8N+kwwZZIKpUK8c0574FMH6FHZtMQrtfzb2BRx33EZPNAUpLMUs0au8WeKYnzkZbLCZ+OcdIt70d3 wb7uoIMacw9ZFkcY86Ub4drx9znR/OezZ7nkS5/RdoISFLX9vjq2bVShgSm/y5JvyrWFotWkyXBXP aubzO1ABdOt9k9LCVFeOTo9lovITdJ9crTx59CZRHFSrhwGYw7YWilKv+XZ8ktvifnEdw+xdJb0VD 4thqtfCA==; Received: from 2001-1c00-8d85-5700-266e-96ff-fe07-7dcc.cable.dynamic.v6.ziggo.nl ([2001:1c00:8d85:5700:266e:96ff:fe07:7dcc] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.98.2 #2 (Red Hat Linux)) id 1vjE1h-00000001bnr-2SNU; Fri, 23 Jan 2026 10:04:25 +0000 Received: by noisy.programming.kicks-ass.net (Postfix, from userid 1000) id 260263007E1; Fri, 23 Jan 2026 11:04:25 +0100 (CET) Date: Fri, 23 Jan 2026 11:04:25 +0100 From: Peter Zijlstra To: Qiliang Yuan 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, Qiliang Yuan Subject: Re: [PATCH] sched/fair: Optimize idle core discovery algorithm via LLC-wide bitmask Message-ID: <20260123100425.GJ171111@noisy.programming.kicks-ass.net> References: <20260122152024.124979-1-realwujing@gmail.com> 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: <20260122152024.124979-1-realwujing@gmail.com> On Thu, Jan 22, 2026 at 10:20:24AM -0500, Qiliang Yuan wrote: > The current select_idle_cpu() employs a linear O(N) scan to find idle > cores, which scales poorly on modern high-core-count systems. > > This patch optimizes the discovery algorithm by: > 1. Adding a per-LLC 'idle_cores_mask' to sched_domain_shared for > tracking core-level idle status. > 2. Converting the linear search into an efficient bitmask iteration, > reducing typical search complexity towards O(1) in sparse scenarios. > 3. Implementing a lazy-clear mechanism during the scan to maintain > efficiency without expensive global synchronization. > > This algorithmic refinement minimizes the search space in the critical > wakeup path, effectively mitigating linear scaling overhead on large > SMT machines. Since this is a performance patch; what is missing here is the actual performance data. This can be in the form of a micro-benchmark, or perf numbers showing the improvement for this code-path. Also, what kind of topologies have you tested this on; typically Intel has a few very large LLC domains while AMD has more smaller ones.