[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <cc0b9d1b-7039-404c-a33f-66d2e8872135@intel.com>
Date: Thu, 8 May 2025 08:50:17 -0700
From: Reinette Chatre <reinette.chatre@...el.com>
To: Tony Luck <tony.luck@...el.com>, Fenghua Yu <fenghuay@...dia.com>, "Maciej
Wieczor-Retman" <maciej.wieczor-retman@...el.com>, Peter Newman
<peternewman@...gle.com>, James Morse <james.morse@....com>, Babu Moger
<babu.moger@....com>, Drew Fustini <dfustini@...libre.com>, Dave Martin
<Dave.Martin@....com>, Anil Keshavamurthy <anil.s.keshavamurthy@...el.com>,
Chen Yu <yu.c.chen@...el.com>
CC: <x86@...nel.org>, <linux-kernel@...r.kernel.org>,
<patches@...ts.linux.dev>
Subject: Re: [PATCH v4 14/31] fs/resctrl: Add an architectural hook called for
each mount
Hi Tony,
On 4/28/25 5:33 PM, Tony Luck wrote:
> --- a/include/linux/resctrl.h
> +++ b/include/linux/resctrl.h
> @@ -450,6 +450,12 @@ void resctrl_offline_mon_domain(struct rdt_resource *r, struct rdt_domain_hdr *h
> void resctrl_online_cpu(unsigned int cpu);
> void resctrl_offline_cpu(unsigned int cpu);
>
> +/*
> + * Architecture hook called for each attempted file system mount
End sentence with period.
> + * No locks are held.
> + */
> +void resctrl_arch_pre_mount(void);
> +
> /**
> * resctrl_arch_rmid_read() - Read the eventid counter corresponding to rmid
> * for this resource and domain.
> diff --git a/arch/x86/kernel/cpu/resctrl/core.c b/arch/x86/kernel/cpu/resctrl/core.c
> index 58bc218070e2..2f3efc4b1816 100644
> --- a/arch/x86/kernel/cpu/resctrl/core.c
> +++ b/arch/x86/kernel/cpu/resctrl/core.c
> @@ -707,6 +707,14 @@ static int resctrl_arch_offline_cpu(unsigned int cpu)
> return 0;
> }
>
> +void resctrl_arch_pre_mount(void)
> +{
> + static atomic_t only_once;
> +
> + if (atomic_cmpxchg(&only_once, 0, 1))
> + return;
> +}
As I understand atomic_try_cmpxchg() is preferred on x86. See
"CMPXCHG vs TRY_CMPXCHG" in Documentation/atomic_t.txt for reference.
Reinette
Powered by blists - more mailing lists