Re: [PATCH v12 05/21] futex: Create hb scopes

From: Peter Zijlstra
Date: Fri May 16 2025 - 09:23:30 EST


On Tue, May 06, 2025 at 08:45:06PM -0300, André Almeida wrote:
> Em 16/04/2025 13:29, Sebastian Andrzej Siewior escreveu:
> > From: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
> >
> > Create explicit scopes for hb variables; almost pure re-indent.
> >
> > Signed-off-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>
> > Signed-off-by: Sebastian Andrzej Siewior <bigeasy@xxxxxxxxxxxxx>
> > ---
> > kernel/futex/core.c | 81 ++++----
> > kernel/futex/pi.c | 282 +++++++++++++-------------
> > kernel/futex/requeue.c | 433 ++++++++++++++++++++--------------------
> > kernel/futex/waitwake.c | 193 +++++++++---------
> > 4 files changed, 504 insertions(+), 485 deletions(-)
> >
> > diff --git a/kernel/futex/core.c b/kernel/futex/core.c
> > index 7adc914878933..e4cb5ce9785b1 100644
> > --- a/kernel/futex/core.c
> > +++ b/kernel/futex/core.c
> > @@ -944,7 +944,6 @@ static void exit_pi_state_list(struct task_struct *curr)
> > {
> > struct list_head *next, *head = &curr->pi_state_list;
> > struct futex_pi_state *pi_state;
> > - struct futex_hash_bucket *hb;
> > union futex_key key = FUTEX_KEY_INIT;
> > /*
> > @@ -957,50 +956,54 @@ static void exit_pi_state_list(struct task_struct *curr)
> > next = head->next;
> > pi_state = list_entry(next, struct futex_pi_state, list);
> > key = pi_state->key;
> > - hb = futex_hash(&key);
> > + if (1) {
>
> Couldn't those explict scopes be achive without the if (1), just {}?

Yes, this is possible. I have some experience with people getting
confused with that style though. But yeah, whatever :-)