[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87cyhzcyht.ffs@tglx>
Date: Tue, 10 Dec 2024 17:07:58 +0100
From: Thomas Gleixner <tglx@...utronix.de>
To: Sebastian Andrzej Siewior <bigeasy@...utronix.de>,
linux-kernel@...r.kernel.org
Cc: André Almeida <andrealmeid@...lia.com>, Darren Hart
<dvhart@...radead.org>, Davidlohr Bueso <dave@...olabs.net>, Ingo Molnar
<mingo@...hat.com>, Juri Lelli <juri.lelli@...hat.com>, Peter Zijlstra
<peterz@...radead.org>, Valentin Schneider <vschneid@...hat.com>, Waiman
Long <longman@...hat.com>, Sebastian Andrzej Siewior
<bigeasy@...utronix.de>
Subject: Re: [PATCH v4 03/11] futex: Allow automatic allocation of process
wide futex hash.
On Tue, Dec 03 2024 at 17:42, Sebastian Andrzej Siewior wrote:
> +static bool need_futex_hash_allocate_default(u64 clone_flags)
> +{
> + if ((clone_flags & (CLONE_THREAD | CLONE_VM)) != (CLONE_THREAD | CLONE_VM))
> + return false;
> + if (!thread_group_empty(current))
> + return false;
> + if (current->mm->futex_hash_bucket)
> + return false;
If you add an accessor like:
if (mm_get_futex_hash_bucket(current->mm))
then you can either #ifdef the futex muck in mm_struct or make it
struct mm_futex_hash_bucket {
#ifdef CONFIG_FUTEX
unsigned int futex_hash_mask;
struct futex_hash_bucket *futex_hash_bucket;
#endif
};
and avoid the #ifdeffery in mm_struct itself because the empty struct
occupies zero space.
The accessor and the other helpers allow the the compiler to optimize
all of it out for CONFIG_FUTEX=n.
Thanks,
tglx
Powered by blists - more mailing lists