From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.11]) (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 BB8ED1F7541 for ; Fri, 20 Feb 2026 19:35:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.11 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771616160; cv=none; b=bhr4AyZuu0mUcF0CBY6Fatgllz9e4DP/9Rb/GX8Bm8nT9TPm9X5mubCqUAccUXSMhtfoN8tS5M0ZkBcJvsxofDbA9nJ+god1MpFmc7zSRsxakJswRAN0oZV2on4pC2TiGG5wVO6HSCZbDp5L5dUdewRycxTNPjI6FQsNXAobz2I= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771616160; c=relaxed/simple; bh=pGupjGeUwAGFYVveANivBAdbZp6bie1eeuiLcqvgP6E=; h=Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References: Content-Type:MIME-Version; b=mWkrqslOvDGLJYy0qrv9YzWzMDo1nREnA90O6Hy6QSCdRQlUEtrT9AVHHJRWgH4mrwaVBYKyQismayeCInUOVuwSBbMEgkt6a9kPfIP33UD7SWSfkrRkJAtD/WFpyzDLFodsUdHblAkGyorwZhZepyOfAOotHPb3kXhPlY9G7Bc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=pass smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=L5tkrEZD; arc=none smtp.client-ip=198.175.65.11 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="L5tkrEZD" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1771616157; x=1803152157; h=message-id:subject:from:to:cc:date:in-reply-to: references:content-transfer-encoding:mime-version; bh=pGupjGeUwAGFYVveANivBAdbZp6bie1eeuiLcqvgP6E=; b=L5tkrEZDD1+5yiKgZqqEu5vmZynbMowoUc+7xYpwnkCnAUklPEEo5hYi hKKV08Oh1rPJf1YC9CdHO+yBXLXNrYBD7+xg69ahmaXl5df0Hjm2auzpY 9n10g0cqTqGjJwKM/eHDwTCKCEG1gyZN1ks8hS5tyLfTx+RfwVl+Ya0eL 4HWm2AXU69zxmk60uN6hIceu+AykwZRQOEMfZe4gT7dQPEXHsV3+Pog4J YT05v2OqhJ+zl8952I2TF3NpqM4cm+HlhVbXJy2QBuPqUDJwUEBlFD6+P QaUn3KJJtV+VfmWHksi3z5ofKM0BPxSEaEcN5GKGFYcZiice4FK53FB5K A==; X-CSE-ConnectionGUID: 7lBFZloBRH6Ut1dS9k4oFw== X-CSE-MsgGUID: KuFKcmIUTEOJ894nwuMXGQ== X-IronPort-AV: E=McAfee;i="6800,10657,11707"; a="83032708" X-IronPort-AV: E=Sophos;i="6.21,302,1763452800"; d="scan'208";a="83032708" Received: from orviesa003.jf.intel.com ([10.64.159.143]) by orvoesa103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Feb 2026 11:35:56 -0800 X-CSE-ConnectionGUID: ke6dPupgROOcNwqlgJO9iA== X-CSE-MsgGUID: tT7EGBK9TaqbMGXX9E3Tgw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.21,302,1763452800"; d="scan'208";a="219080738" Received: from schen9-mobl4.amr.corp.intel.com (HELO [10.125.110.105]) ([10.125.110.105]) by ORVIESA003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Feb 2026 11:35:57 -0800 Message-ID: Subject: Re: [PATCH v3 04/21] sched/cache: Make LLC id continuous From: Tim Chen To: Peter Zijlstra Cc: "Chen, Yu C" , Ingo Molnar , "Gautham R . Shenoy" , Vincent Guittot , Juri Lelli , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Valentin Schneider , Madadi Vineeth Reddy , Hillf Danton , Shrikanth Hegde , Jianyong Wu , Yangyu Chen , Tingyin Duan , Vern Hao , Vern Hao , Len Brown , Aubrey Li , Zhao Liu , Chen Yu , Adam Li , Aaron Lu , Tim Chen , Josh Don , Gavin Guo , Qais Yousef , Libo Chen , linux-kernel@vger.kernel.org, K Prateek Nayak Date: Fri, 20 Feb 2026 11:35:57 -0800 In-Reply-To: <20260220193027.GT1395266@noisy.programming.kicks-ass.net> References: <60a05a3f50d14a7bf3b968f62cca87893c5c552c.1770760558.git.tim.c.chen@linux.intel.com> <79755f7d-cc68-4189-b6d8-850378e54017@amd.com> <20260219154007.GI1395266@noisy.programming.kicks-ass.net> <2ffbceaa-f9ab-461a-8324-3f500fcf8786@intel.com> <20260220160300.GH2995752@noisy.programming.kicks-ass.net> <20260220193027.GT1395266@noisy.programming.kicks-ass.net> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.58.1 (3.58.1-1.fc43) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 On Fri, 2026-02-20 at 20:30 +0100, Peter Zijlstra wrote: > On Fri, Feb 20, 2026 at 11:24:11AM -0800, Tim Chen wrote: >=20 > > +static int __sched_domains_alloc_llc_id(void) > > +{ > > + int lid, max_lid; > > + > > + lockdep_assert_held(&sched_domains_mutex); > > + > > + lid =3D cpumask_first_zero(sched_domains_llc_id_allocmask); > > + /* > > + * llc_id space should never grow larger than the > > + * possible number of CPUs in the system. > > + */ > > + BUG_ON(lid >=3D nr_cpu_ids); >=20 > __cpumask_set_cpu(lid, sched_domains_llc_is_allocmask); Ah yes, fat fingers delete one line too many. >=20 > > + max_lid =3D cpumask_last(sched_domains_llc_id_allocmask); > > + /* size is one more than max index */ > > + tl_max_llcs =3D max(lid, max_lid) + 1; > > + > > + return lid; > > +} > > + > > +static void __sched_domains_free_llc_id(int cpu) > > +{ > > + int i, lid, last_lid; > > + > > + lockdep_assert_held(&sched_domains_mutex); > > + > > + lid =3D per_cpu(sd_llc_id, cpu); > > + if (lid =3D=3D -1) > > + return; > > + > > + BUG_ON(lid >=3D nr_cpu_ids); > > + per_cpu(sd_llc_id, cpu) =3D -1; > > + > > + for_each_cpu(i, cpu_coregroup_mask(cpu)) { > > + /* An online CPU owns the llc_id. */ > > + if (per_cpu(sd_llc_id, i) =3D=3D lid) > > + return; > > + } > > + > __cpumask_clear_cpu(lid, sched_domains_llc_id_allocmask); > > + > > + last_lid =3D cpumask_last(sched_domains_llc_id_allocmask); > > + /* shrink max LLC size to save memory */ > > + if (last_lid < tl_max_llcs - 1) > > + tl_max_llcs =3D last_lid + 1; > > +} >=20 > Might be simpler to just track max_lid, and do the +1 at the alloc site? >=20 Sure, will do. Will also update the code to validate lid value accordingly= . Tim