Commit d854e4e7 authored by Peter Zijlstra's avatar Peter Zijlstra
Browse files

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: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: default avatarSebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lore.kernel.org/r/20250416162921.513656-8-bigeasy@linutronix.de
parent 6c67f8d8
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -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
+8 −0
Original line number Diff line number Diff line
@@ -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