From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 C80803DBD51 for ; Tue, 19 May 2026 08:46:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.92.199 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779180410; cv=none; b=dD2oqn9N3C5focHegYQ7nSgPepExcxXhOG19yrtkPWAVwo/ALQeEO6SSnIFH4OOut6uywcP/fSCZr9egh9JHsMbHSMChr0+tzmC5H2jD8l/eHk9S2mAtE0o5SVwg76WThkzBe3sUB0/lYdiwUMUMDiRERm3fvJ5uL7PuMJiC4ek= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779180410; c=relaxed/simple; bh=u71vucLkv0FLOmhCRZhudvMGgqfIhNgvZgMkxktNuOo=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=mvysCcbSd0C+3dRFap+/QNlFVX/0xPJWXLLkexyVdvoYQrPvxaOncejz3N5FjwVsdf0rv4Oc7w9D2Y5a9cturiL3013tS3H6ee0KOwKm4VSqUMcTku7Yd2hj/upvFjSfWFyGmQWzOTDN6IVz5bh9SqVi+0oDnLHyMla8yDfQO64= 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=moe9TiPO; arc=none smtp.client-ip=90.155.92.199 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="moe9TiPO" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; 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=yLetP58Y1N7f7xbDm5dgu53Gnpb4EfJNwJAnuTHoG9M=; b=moe9TiPOtL8nkCznHQeBM8CZgW y+Cx4vNRGuGiUF/gc19u2T4S80wiYHLGtWd8tY6jICAW0EGxqJ2/wZAkT5GxeRxY3qPXYcN9wDJTd elqQtSy+VeoSWOnlU4gwoGZUwgBbis5BI1ubWpD9/oy7mx+am1AA0osPtg+MUiawqZ5QmPEslCH1d VYwkKVTROJhqS4UkBLioOTDYyZhVJPgBlvKlCopok0EiwNm51vYPHzSylvEVJCs/+5ANuRfEmeb1b GLI7OrNBcaGygk4/rvj771O3Xm1ZRbSrgVZhKTm8zaBgPjlkHR8fo6x03f2EP8hMyuxD22euUTkZw 47W7gMBg==; Received: from 77-249-17-252.cable.dynamic.v4.ziggo.nl ([77.249.17.252] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.99.1 #2 (Red Hat Linux)) id 1wPG5y-0000000Daax-3ZeQ; Tue, 19 May 2026 08:46:36 +0000 Received: by noisy.programming.kicks-ass.net (Postfix, from userid 1000) id 7E884300182; Tue, 19 May 2026 10:46:34 +0200 (CEST) Date: Tue, 19 May 2026 10:46:34 +0200 From: Peter Zijlstra To: K Prateek Nayak Cc: Andrea Righi , Ingo Molnar , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Valentin Schneider , Christian Loehle , Phil Auld , Koba Ko , Felix Abecassis , Balbir Singh , Joel Fernandes , Shrikanth Hegde , linux-kernel@vger.kernel.org, tim.c.chen@linux.intel.com, yu.c.chen@intel.com Subject: Re: [PATCH v2 2/5] sched/fair: Attach sched_domain_shared to sd_asym_cpucapacity Message-ID: <20260519084634.GA3126523@noisy.programming.kicks-ass.net> References: <20260516055850.1345932-1-arighi@nvidia.com> <20260518205859.GY3126523@noisy.programming.kicks-ass.net> <81583f79-facf-473e-b756-31af724245bc@amd.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: <81583f79-facf-473e-b756-31af724245bc@amd.com> On Tue, May 19, 2026 at 11:22:32AM +0530, K Prateek Nayak wrote: > Hello Peter, Andrea, > > On 5/19/2026 2:28 AM, Peter Zijlstra wrote: > > @@@ -2775,20 -3049,16 +3107,15 @@@ build_sched_domains(const struct cpumas > > if (!sd) > > continue; > > > > + if (has_asym) > > - asym_claimed = claim_asym_sched_domain_shared(&d, i); > > ++ claim_asym_sched_domain_shared(&d, i); > > + > > /* First, find the topmost SD_SHARE_LLC domain */ > > while (sd->parent && (sd->parent->flags & SD_SHARE_LLC)) > > sd = sd->parent; > > > > if (sd->flags & SD_SHARE_LLC) { > > - /* > > - * Initialize the sd->shared for SD_SHARE_LLC unless > > - * the asym path above already claimed it. > > - */ > > - if (!asym_claimed) > > - init_sched_domain_shared(&d, sd); > > - int sd_id = cpumask_first(sched_domain_span(sd)); > > - > > - sd->shared = *per_cpu_ptr(d.sds, sd_id); > > - atomic_set(&sd->shared->nr_busy_cpus, sd->span_weight); > > - atomic_inc(&sd->shared->ref); > > ++ init_sched_domain_shared(&d, sd); > > This will run into a small problem with "nr_idle_scan" if > cpumask_first(sched_domain_span(sd)) is the same for both sd_asym and > sd_llc. > > Load balancer at different domains will populate "nr_idle_scan" with > different values and they alias to same ->shared if one isn't > degenerated and I believe there is at least one way to hit the WARN_ON() > from cpu_attach_domain() if the SD_ASYM_CPUCAPACITY_FULL comes before > the last SD_SHARE_LLC domain and the latter is degenerated. > > How about this: > > (On top of queue:sched/core; Lightly tested on !ASYM_CPUCAPACITY system) Shrikanth noted I had an old version of his SMT ifdeffery patches on, so I need to rebuild that tree (and the merge) anyway. Do you want me to munge this in, or keep it on top as a fixie?