[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aVwTcX7V_HN2j6SW@agluck-desk3>
Date: Mon, 5 Jan 2026 11:39:29 -0800
From: "Luck, Tony" <tony.luck@...el.com>
To: Borislav Petkov <bp@...en8.de>
CC: Fenghua Yu <fenghuay@...dia.com>, Reinette Chatre
<reinette.chatre@...el.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>, Chen Yu
<yu.c.chen@...el.com>, <x86@...nel.org>, <linux-kernel@...r.kernel.org>,
<patches@...ts.linux.dev>
Subject: Re: [PATCH v17 13/32] x86,fs/resctrl: Add an architectural hook
called for each mount
On Mon, Jan 05, 2026 at 08:17:11PM +0100, Borislav Petkov wrote:
> On Wed, Dec 17, 2025 at 09:21:00AM -0800, Tony Luck wrote:
> > +void resctrl_arch_pre_mount(void)
> > +{
> > + static atomic_t only_once = ATOMIC_INIT(0);
> > + int old = 0;
> > +
> > + if (!atomic_try_cmpxchg(&only_once, &old, 1))
> > + return;
> > +}
>
> There's
>
> #define DO_ONCE(func, ...)
>
> Can't use that?
Learn something new every day. Yes, <linux/once.h> looks possible here.
Though I believe I'll need the DO_ONCE_SLEEPABLE() version since
resctrl_arch_pre_mount() grabs a mutex and various called functions
allocate memory using kmalloc().
-Tony
Powered by blists - more mailing lists