44
55#include <linux/sched.h>
66#include <linux/ktime.h>
7+ #include <linux/mm_types.h>
78
89#include <uapi/linux/futex.h>
910
1011struct inode ;
11- struct mm_struct ;
1212struct task_struct ;
1313
1414/*
@@ -34,6 +34,7 @@ union futex_key {
3434 u64 i_seq ;
3535 unsigned long pgoff ;
3636 unsigned int offset ;
37+ /* unsigned int node; */
3738 } shared ;
3839 struct {
3940 union {
@@ -42,11 +43,13 @@ union futex_key {
4243 };
4344 unsigned long address ;
4445 unsigned int offset ;
46+ /* unsigned int node; */
4547 } private ;
4648 struct {
4749 u64 ptr ;
4850 unsigned long word ;
4951 unsigned int offset ;
52+ unsigned int node ; /* NOT hashed! */
5053 } both ;
5154};
5255
@@ -77,7 +80,25 @@ void futex_exec_release(struct task_struct *tsk);
7780
7881long do_futex (u32 __user * uaddr , int op , u32 val , ktime_t * timeout ,
7982 u32 __user * uaddr2 , u32 val2 , u32 val3 );
80- #else
83+ int futex_hash_prctl (unsigned long arg2 , unsigned long arg3 , unsigned long arg4 );
84+
85+ #ifdef CONFIG_FUTEX_PRIVATE_HASH
86+ int futex_hash_allocate_default (void );
87+ void futex_hash_free (struct mm_struct * mm );
88+
89+ static inline void futex_mm_init (struct mm_struct * mm )
90+ {
91+ RCU_INIT_POINTER (mm -> futex_phash , NULL );
92+ mutex_init (& mm -> futex_hash_lock );
93+ }
94+
95+ #else /* !CONFIG_FUTEX_PRIVATE_HASH */
96+ static inline int futex_hash_allocate_default (void ) { return 0 ; }
97+ static inline void futex_hash_free (struct mm_struct * mm ) { }
98+ static inline void futex_mm_init (struct mm_struct * mm ) { }
99+ #endif /* CONFIG_FUTEX_PRIVATE_HASH */
100+
101+ #else /* !CONFIG_FUTEX */
81102static inline void futex_init_task (struct task_struct * tsk ) { }
82103static inline void futex_exit_recursive (struct task_struct * tsk ) { }
83104static inline void futex_exit_release (struct task_struct * tsk ) { }
@@ -88,6 +109,17 @@ static inline long do_futex(u32 __user *uaddr, int op, u32 val,
88109{
89110 return - EINVAL ;
90111}
112+ static inline int futex_hash_prctl (unsigned long arg2 , unsigned long arg3 , unsigned long arg4 )
113+ {
114+ return - EINVAL ;
115+ }
116+ static inline int futex_hash_allocate_default (void )
117+ {
118+ return 0 ;
119+ }
120+ static inline void futex_hash_free (struct mm_struct * mm ) { }
121+ static inline void futex_mm_init (struct mm_struct * mm ) { }
122+
91123#endif
92124
93125#endif
0 commit comments