4 #include <linux/list.h>
6 #include <uapi/linux/shm.h>
7 #include <asm/shmparam.h>
9 struct shmid_kernel
/* private to the kernel */
11 struct kern_ipc_perm shm_perm
;
12 struct file
*shm_file
;
13 unsigned long shm_nattch
;
14 unsigned long shm_segsz
;
20 struct user_struct
*mlock_user
;
22 /* The task created the shm object. NULL if the task is dead. */
23 struct task_struct
*shm_creator
;
24 struct list_head shm_clist
; /* list by creator */
27 /* shm_mode upper byte flags */
28 #define SHM_DEST 01000 /* segment will be destroyed on last detach */
29 #define SHM_LOCKED 02000 /* segment will not be swapped */
30 #define SHM_HUGETLB 04000 /* segment will use huge TLB pages */
31 #define SHM_NORESERVE 010000 /* don't check for reservations */
33 /* Bits [26:31] are reserved */
36 * When SHM_HUGETLB is set bits [26:31] encode the log2 of the huge page size.
37 * This gives us 6 bits, which is enough until someone invents 128 bit address
40 * Assume these are all power of twos.
41 * When 0 use the default page size.
43 #define SHM_HUGE_SHIFT 26
44 #define SHM_HUGE_MASK 0x3f
45 #define SHM_HUGE_2MB (21 << SHM_HUGE_SHIFT)
46 #define SHM_HUGE_1GB (30 << SHM_HUGE_SHIFT)
50 struct list_head shm_clist
;
53 long do_shmat(int shmid
, char __user
*shmaddr
, int shmflg
, unsigned long *addr
,
54 unsigned long shmlba
);
55 bool is_file_shm_hugepages(struct file
*file
);
56 void exit_shm(struct task_struct
*task
);
57 #define shm_init_task(task) INIT_LIST_HEAD(&(task)->sysvshm.shm_clist)
63 static inline long do_shmat(int shmid
, char __user
*shmaddr
,
64 int shmflg
, unsigned long *addr
,
69 static inline bool is_file_shm_hugepages(struct file
*file
)
73 static inline void exit_shm(struct task_struct
*task
)
76 static inline void shm_init_task(struct task_struct
*task
)
81 #endif /* _LINUX_SHM_H_ */