From mboxrd@z Thu Jan 1 00:00:00 1970 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 1CBA6313E07 for ; Mon, 15 Jun 2026 18:25:11 +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=1781547912; cv=none; b=CYXi/Jw5OlA9zwBg9tfcCk/+sazfcE5/iDOgQ1Ox2zJQQIeqwsGd/rE1PMCm7apEEZpOkiO2hGmVjV5g36RpAFPYyMxav7uNeRqu8Oo04/mApYTttg/Jr1btrpxSwZgiSW/fS1CSBLd/YDkElamTRTIbq6r0TDBjjaLxdaVgvIk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781547912; c=relaxed/simple; bh=lLBCWvlZ8cRVEaDn3jj+Op8c5L4RsOuuqU3grwlC7Es=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=cW2ECG4zlmiWXdsirjzIRyPrGjPKXYJGVwt7cPHic/I6xTTmuE8XGzOZ1fsJZb9DNbzUb37j/AIuMqWjmsej4o2fiiwpsqt4m2/4JPrjA9+OC9nVDBN600Kx0dyxeosHFyP7Dy609H3b8LKYd3Eagva042rzCXTIyGetqLcFI0g= 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=ecSbW2Cm; 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="ecSbW2Cm" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1781547911; x=1813083911; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=lLBCWvlZ8cRVEaDn3jj+Op8c5L4RsOuuqU3grwlC7Es=; b=ecSbW2Cm/8NEegwBb4XPKyClWZWOTvOZmq653Vi3Tq/jYSVdurwe5lIB zoF7fCR9GWCaGGv5E8ozKvoC2ceU2cxI+scsHE8v+8F7NHqeumu1ffNTw rwvFDKkzF0mNzUzxOlz9jVTAzSCJtQq/g77maB9GFzF1sQ67vWbVGohlo nkPQaY4a9XBj1dYcueu0cbne4Wttv9JvfzD0wUBz1vLGd2oNtjwtix1fd jljel3XGQxos+CYmtn7P/2HJCZmxVUmtCofbEO5OB5ZhlY9M/ddpmzPMW MCTNybE8DbDoe0Sg+npWSJPCHumrDhEjv/EMY01wsvHopRqnv1yQF9Vgt w==; X-CSE-ConnectionGUID: hFzjQr31QPikezZ3TWCO7w== X-CSE-MsgGUID: EZxMEbbZSouNWFdko+3kdQ== X-IronPort-AV: E=McAfee;i="6800,10657,11818"; a="93789967" X-IronPort-AV: E=Sophos;i="6.24,206,1774335600"; d="scan'208";a="93789967" Received: from orviesa007.jf.intel.com ([10.64.159.147]) by orvoesa104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Jun 2026 11:25:08 -0700 X-CSE-ConnectionGUID: zdkDylV3REKoxsGAobN91g== X-CSE-MsgGUID: YZCwwsLGTQSiqHyWQesV1w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.24,206,1774335600"; d="scan'208";a="247620623" Received: from spandruv-desk1.amr.corp.intel.com (HELO agluck-desk3.intel.com) ([10.124.221.121]) by orviesa007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Jun 2026 11:25:08 -0700 From: Tony Luck To: Fenghua Yu , Reinette Chatre , Maciej Wieczor-Retman , Peter Newman , James Morse , Babu Moger , Drew Fustini , Dave Martin , Chen Yu , David E Box , x86@kernel.org Cc: Christoph Hellwig , linux-kernel@vger.kernel.org, patches@lists.linux.dev, Tony Luck Subject: [PATCH v8 06/16] fs/resctrl: Remove redundant calls to resctrl_arch_mon_capable() Date: Mon, 15 Jun 2026 11:24:47 -0700 Message-ID: <20260615182457.14725-7-tony.luck@intel.com> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260615182457.14725-1-tony.luck@intel.com> References: <20260615182457.14725-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: 8bit Architecture code provides resctrl_arch_mon_capable() so that file system code knows whether any monitor features are supported. This is used to decide whether to create "mon_data" directories etc. Initially resctrl_arch_mon_capable() was an inline function providing the value of the x86 architecture variable "rdt_mon_capable". I.e. extremely low overhead and so it was used liberally as a sanity check. The ARM implementation of resctrl_arch_mon_capable() is not inline and chases a couple of pointers. Future changes to x86 implementation will also make resctrl_arch_mon_capable() more expensive. Redundant calls to resctrl_arch_mon_capable() in hot code paths should be eliminated. 1) mbm_handle_overflow() This function is called once per second from worker threads running on each L3 domain. The call is clearly redundant because worker threads are only created if the MBM monitoring feature is enabled. 2) is_rmid_match() This function is called when a user reads a "tasks" file of a MON_GROUP. The call is redundant because the function also checks "r->type == RDTMON_GROUP" and this type of group can only be created on systems that support monitoring. Remove the call to resctrl_arch_mon_capable() from both of these functions. Signed-off-by: Tony Luck --- v8: New patch fs/resctrl/monitor.c | 2 +- fs/resctrl/rdtgroup.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/resctrl/monitor.c b/fs/resctrl/monitor.c index 9fd901c78dc6..3df188bee433 100644 --- a/fs/resctrl/monitor.c +++ b/fs/resctrl/monitor.c @@ -848,7 +848,7 @@ void mbm_handle_overflow(struct work_struct *work) * If the filesystem has been unmounted this work no longer needs to * run. */ - if (!resctrl_mounted || !resctrl_arch_mon_capable()) + if (!resctrl_mounted) goto out_unlock; r = resctrl_arch_get_resource(RDT_RESOURCE_L3); diff --git a/fs/resctrl/rdtgroup.c b/fs/resctrl/rdtgroup.c index a8f84b653607..c671644f1e12 100644 --- a/fs/resctrl/rdtgroup.c +++ b/fs/resctrl/rdtgroup.c @@ -691,7 +691,7 @@ static bool is_closid_match(struct task_struct *t, struct rdtgroup *r) static bool is_rmid_match(struct task_struct *t, struct rdtgroup *r) { - return (resctrl_arch_mon_capable() && (r->type == RDTMON_GROUP) && + return ((r->type == RDTMON_GROUP) && resctrl_arch_match_rmid(t, r->mon.parent->closid, r->mon.rmid)); } -- 2.54.0