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 A36E3456E1A for ; Tue, 1 Sep 2026 08:02:39 +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=1788249762; cv=none; b=tt2TrQlq/Uj9hdB4lAziw7nUFVtCHo/9Ujuzox2b3kEnu45qT4eGPRUcKOk2mqUA1d2I/R9sYh5Tc8wefCs/Freh4T4XkzRyrvjOnlwN3BfSfyIhFYc0EonIqOrR8yaGIuTXfPbxEJxol0F1d+Owhsf8ZcvVoHiNSq6o44rPfpY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788249762; c=relaxed/simple; bh=rU2Xm16PUG3o0wSTlsBFI6p6bcqHDKOPxubdzScUMQ8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=uVbb39RxLgWPuBJ+awofvHWuNF279oAJcPPmDwD7f/VnrJr0dSIvG7kd0KmrcIVqASeK0KuLZ5rZjeW72CdRHDYs3AydVvHZsaMZvfssQKFqEYfJY8UViaonhiZZfF5cuJebdATgi5XyJrJ96lzKC0ESI7bEldaN2cFhUslYyik= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=infradead.org; spf=pass smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=aG7jL0US; 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=pass 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="aG7jL0US" 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=hIORJwUFUu1xQvcDenW4pwSoxemSIs5615nsSp+Drl0=; b=aG7jL0USdHAN6TCMpSVVc+AW4w ASUjnslClIMVHwBGKOckVaM5Mc/uuBbNilYEmnJbIGHNshKJPaP2tRMWSV3fhlovewzXZX7wKhfbd LMYm/6KMWd5LqmsGGB/UaUYzBwaCpbi/xO+GZ1s/NnDWj2pOy2dNw90Q+VxMrP5Q/Bj6pRN1UzbVC EMwQtwFS99FAbO31C9E5onyJypc+m9WPYmhbzY43IuHm/7xrD/hQ/GYOlBigiwzIF4UB54fZegLK1 zbKQ6hVR7cGurIhJgwSWJIpt23+NXwOirlVw166bhP3gl8uiOaWPwPNRq98qtrTVXzW89uqxoD+ot sIvdbTJw==; 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.99.1 #2 (Red Hat Linux)) id 1x1JRb-00000004hjW-2D31; Tue, 01 Sep 2026 08:02:11 +0000 Received: by noisy.programming.kicks-ass.net (Postfix, from userid 1000) id 2285F3002ED; Tue, 01 Sep 2026 10:02:10 +0200 (CEST) Date: Tue, 1 Sep 2026 10:02:10 +0200 From: Peter Zijlstra To: Jianyong Wu Cc: Ingo Molnar , Juri Lelli , Vincent Guittot , Chen Yu , Tim Chen , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Valentin Schneider , K Prateek Nayak , Shrikanth Hegde , Phil Auld , Andrew Morton , David Hildenbrand , linux-kernel@vger.kernel.org, linux-mm@kvack.org, jianyong.wu@outlook.com, zhongyuan@hygon.cn, huangsj@hygon.cn, wangfengyu@hygon.cn, yingzhiwei@hygon.cn, justin.he@arm.com Subject: Re: [RFC PATCH v2 10/23] sched/topology: Add per-sd scratch for the load balance affinity score Message-ID: <20260901080210.GP4120091@noisy.programming.kicks-ass.net> References: <20260827122816.756234-1-wujianyong@hygon.cn> <20260827122816.756234-11-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: <20260827122816.756234-11-wujianyong@hygon.cn> On Thu, Aug 27, 2026 at 08:28:03PM +0800, Jianyong Wu wrote: > The affinity score computed during load balancing needs two small arrays, > one entry per LLC: the LLCs that sit closer to the balance destination than > to the source, and the weight of each. Their size is only known once the > sched domains have been built, which is why the load balancer currently has > to allocate them on every call. > > Signed-off-by: Jianyong Wu > --- > include/linux/sched/topology.h | 6 ++++++ > kernel/sched/topology.c | 28 +++++++++++++++++++++++++++- > 2 files changed, 33 insertions(+), 1 deletion(-) > > diff --git a/include/linux/sched/topology.h b/include/linux/sched/topology.h > index b31d2cf16592..569ff562dbdb 100644 > --- a/include/linux/sched/topology.h > +++ b/include/linux/sched/topology.h > @@ -122,6 +122,12 @@ struct sched_domain { > unsigned int *llc_counts __counted_by_ptr(llc_max); > unsigned long llc_bytes; > unsigned int *numa_counts; > + /* > + * Scratch for the load balance affinity score, llc_max entries each. > + * Only the bottom sd owns them, like llc_counts above. > + */ > + int *affi_ids; > + int *affi_weights; Per the below, these should also have: __counted_by_ptr(llc_max), right? > #endif > + p_ids = kcalloc_node(max_lid + 1, sizeof(int), > + GFP_KERNEL, cpu_to_node(i)); > + p_w = kcalloc_node(max_lid + 1, sizeof(int), > + GFP_KERNEL, cpu_to_node(i));