Re: [PATCH v4 02/11] futex: Add basic infrastructure for local task local hash.

Thomas Gleixner
2024-12-10T15:23:55Z

On Tue, Dec 03 2024 at 17:42, Sebastian Andrzej Siewior wrote:
> long do_futex(u32 __user *uaddr, int op, u32 val, ktime_t *timeout,
> u32 __user *uaddr2, u32 val2, u32 val3);
> +int futex_hash_prctl(unsigned long arg2, unsigned long arg3,
> + unsigned long arg4, unsigned long arg5);
> +int futex_hash_allocate_default(void);
> +void futex_hash_free(struct mm_struct *mm);
> +
> +static inline void futex_mm_init(struct mm_struct *mm)
> +{
> + mm->futex_hash_bucket = NULL;
> +}
> +
> #else
> static inline void futex_init_task(struct task_struct *tsk) { }
> static inline void futex_exit_recursive(struct task_struct *tsk) { }
> @@ -88,6 +98,18 @@ static inline long do_futex(u32 __user *uaddr, int op, u32 val,
> {
> return -EINVAL;
> }
> +static inline int futex_hash_prctl(unsigned long arg2, unsigned long arg3,
> + unsigned long arg4, unsigned long arg5)
> +{
> + return -EINVAL;
> +}
> +static inline int futex_hash_allocate_default(void)
> +{
> + return 0;
> +}
> +static inline void futex_hash_free(struct mm_struct *mm) { }
> +static inline void futex_mm_init(struct mm_struct *mm) { }
> +
> #endif
>
> #endif
> diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
> index 7361a8f3ab68e..b16b97ab8fb2a 100644
> --- a/include/linux/mm_types.h
> +++ b/include/linux/mm_types.h
> @@ -30,6 +30,7 @@
> #define INIT_PASID 0
>
> struct address_space;
> +struct futex_hash_bucket;
> struct mem_cgroup;
>
> /*
> @@ -902,6 +903,8 @@ struct mm_struct {
> int mm_lock_seq;
> #endif
>
> + unsigned int futex_hash_mask;
> + struct futex_hash_bucket *futex_hash_bucket;

So you provided stubs for the accessors/init functions etc. Shouldn't
this be #ifdef guarded too?

Thanks,

tglx