From nobody Sun Feb 8 11:44:36 2026 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.12]) (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 E31482F691C for ; Wed, 29 Oct 2025 16:21:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.12 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761754889; cv=none; b=HrK4vnLSVMpxCBi3qkwYErGigjUjptJfCgglK9gBTYEvwVQqooHwU9+1obom+Y9ps6IxaokWJ0i7Y4TVAuiziAxdmmxWRyiUd64zOhq7X4HE9qJXGvS/qMJfhA2VIWLzPq/uxd8M9XC9ku2LHic0OXaV6B+FtCVm1offb/mEe6Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761754889; c=relaxed/simple; bh=/hGO1ZbmzYgehJkTwqb+3EV+zea9ICizU5V8kIZ5Fpc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=f2oKq0qgvj6t4p2dwmf3oxBuD8YxW2jo0ldXAp1hz48oh52XbAOvMxYJGQzksDY+9K5+owGvknt20NWJvVI25KbQ/9gi+kinlGcNFZ/I04tMq7QGOsSwXQ/zcMpjZlr1jI9zg4Uc/RD9JQ+nFdC7ufNdYoghaOpcjiU8V8psX6U= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=WYiRBbOR; arc=none smtp.client-ip=198.175.65.12 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="WYiRBbOR" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1761754887; x=1793290887; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=/hGO1ZbmzYgehJkTwqb+3EV+zea9ICizU5V8kIZ5Fpc=; b=WYiRBbORZ9/yEFlbOlRGAwjG7avZdEabVfnOGJwm7O8b1T1GYuYYhHQe Y3t8ld1jP2Sa+3owPqph9XyFYLObdB2nzHXKtT+n+/yHkg+GctGC1vSO8 LJTL90y0dcauxXspisyCXtI6Z7ylHdn/IVe5+qqfb5Cax+Qeirl8e6cBk nC11MNXIZfxr9lxzgzrZU4cHEhIPOYiuQ64e3IeRYSpWU2UfNEglc037P l8ej2tqtbShgOD5YyNxPeeo8fTdPGVExwAtQs2KE2oR2DPagvp5/8loqN oPazhiQmlsa7qbHgCSBb+a6jXqfgNnxX/TQBDIDvxqyDWrmEWhD3p4ZHB g==; X-CSE-ConnectionGUID: jqcHam1vRLywsAPX40rAVA== X-CSE-MsgGUID: Dwz4PxTqS3mt3T1LyI9f0A== X-IronPort-AV: E=McAfee;i="6800,10657,11597"; a="75330993" X-IronPort-AV: E=Sophos;i="6.19,264,1754982000"; d="scan'208";a="75330993" Received: from orviesa006.jf.intel.com ([10.64.159.146]) by orvoesa104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Oct 2025 09:21:26 -0700 X-CSE-ConnectionGUID: bD7OVxDCRM6IIsKt/WwVFQ== X-CSE-MsgGUID: I7iEMrTwS62UkQ51tDEiTA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.19,264,1754982000"; d="scan'208";a="184901308" Received: from mgerlach-mobl1.amr.corp.intel.com (HELO agluck-desk3.home.arpa) ([10.124.223.146]) by orviesa006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Oct 2025 09:21:26 -0700 From: Tony Luck To: Fenghua Yu , Reinette Chatre , Maciej Wieczor-Retman , Peter Newman , James Morse , Babu Moger , Drew Fustini , Dave Martin , Chen Yu Cc: x86@kernel.org, linux-kernel@vger.kernel.org, patches@lists.linux.dev, Tony Luck Subject: [PATCH v13 04/32] x86/resctrl: Clean up domain_remove_cpu_ctrl() Date: Wed, 29 Oct 2025 09:20:47 -0700 Message-ID: <20251029162118.40604-5-tony.luck@intel.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251029162118.40604-1-tony.luck@intel.com> References: <20251029162118.40604-1-tony.luck@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" For symmetry with domain_remove_cpu_mon() refactor domain_remove_cpu_ctrl() to take an early return when removing a CPU does not empty the domain. Signed-off-by: Tony Luck Reviewed-by: Reinette Chatre --- arch/x86/kernel/cpu/resctrl/core.c | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/arch/x86/kernel/cpu/resctrl/core.c b/arch/x86/kernel/cpu/resct= rl/core.c index c7bfaa391e9f..b28663757dcf 100644 --- a/arch/x86/kernel/cpu/resctrl/core.c +++ b/arch/x86/kernel/cpu/resctrl/core.c @@ -599,28 +599,27 @@ static void domain_remove_cpu_ctrl(int cpu, struct rd= t_resource *r) return; } =20 + cpumask_clear_cpu(cpu, &hdr->cpu_mask); + if (!cpumask_empty(&hdr->cpu_mask)) + return; + if (!domain_header_is_valid(hdr, RESCTRL_CTRL_DOMAIN, r->rid)) return; =20 d =3D container_of(hdr, struct rdt_ctrl_domain, hdr); hw_dom =3D resctrl_to_arch_ctrl_dom(d); =20 - cpumask_clear_cpu(cpu, &d->hdr.cpu_mask); - if (cpumask_empty(&d->hdr.cpu_mask)) { - resctrl_offline_ctrl_domain(r, d); - list_del_rcu(&d->hdr.list); - synchronize_rcu(); - - /* - * rdt_ctrl_domain "d" is going to be freed below, so clear - * its pointer from pseudo_lock_region struct. - */ - if (d->plr) - d->plr->d =3D NULL; - ctrl_domain_free(hw_dom); + resctrl_offline_ctrl_domain(r, d); + list_del_rcu(&hdr->list); + synchronize_rcu(); =20 - return; - } + /* + * rdt_ctrl_domain "d" is going to be freed below, so clear + * its pointer from pseudo_lock_region struct. + */ + if (d->plr) + d->plr->d =3D NULL; + ctrl_domain_free(hw_dom); } =20 static void domain_remove_cpu_mon(int cpu, struct rdt_resource *r) --=20 2.51.0