futex: Create private_hash() get/put class

This gets us:

  fph = futex_private_hash(key) /* gets fph and inc users */
  futex_private_hash_get(fph)   /* inc users */
  futex_private_hash_put(fph)   /* dec users */

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lore.kernel.org/r/20250416162921.513656-8-bigeasy@linutronix.de
This commit is contained in:
Peter Zijlstra 2025-04-16 18:29:07 +02:00
parent 6c67f8d880
commit d854e4e785
2 changed files with 20 additions and 0 deletions

View File

@ -107,6 +107,18 @@ late_initcall(fail_futex_debugfs);
#endif /* CONFIG_FAIL_FUTEX */
struct futex_private_hash *futex_private_hash(void)
{
return NULL;
}
bool futex_private_hash_get(struct futex_private_hash *fph)
{
return false;
}
void futex_private_hash_put(struct futex_private_hash *fph) { }
/**
* futex_hash - Return the hash bucket in the global hash
* @key: Pointer to the futex key for which the hash is calculated

View File

@ -206,10 +206,18 @@ extern struct futex_hash_bucket *futex_hash(union futex_key *key);
extern void futex_hash_get(struct futex_hash_bucket *hb);
extern void futex_hash_put(struct futex_hash_bucket *hb);
extern struct futex_private_hash *futex_private_hash(void);
extern bool futex_private_hash_get(struct futex_private_hash *fph);
extern void futex_private_hash_put(struct futex_private_hash *fph);
DEFINE_CLASS(hb, struct futex_hash_bucket *,
if (_T) futex_hash_put(_T),
futex_hash(key), union futex_key *key);
DEFINE_CLASS(private_hash, struct futex_private_hash *,
if (_T) futex_private_hash_put(_T),
futex_private_hash(), void);
/**
* futex_match - Check whether two futex keys are equal
* @key1: Pointer to key1