1 // SPDX-License-Identifier: GPL-2.0 2 /* 3 * WGCM: Workergroup Control Monitor 4 * 5 * Copyright (c) 2022-2023 Huawei Technologies Co., Ltd. 6 */ 7 8 #ifndef _LINUX_WGCM_H 9 #define _LINUX_WGCM_H 10 11 #include <linux/sched.h> 12 13 #ifdef CONFIG_WGCM 14 #include <linux/types.h> 15 #include <uapi/linux/wgcm.h> 16 17 /* 18 * struct wgcm_task: controls the state of WGCM tasks. 19 */ 20 struct wgcm_task { 21 unsigned int server_tid; 22 23 /* count the number of workers which is bound with server */ 24 atomic_t workers_sum; 25 26 /* count the number of block workers */ 27 atomic_t blk_workers_sum; 28 }; 29 30 /* 31 * use sys_prctl() (see kernel/sys.c) : 32 * wgcm_ctl(): register/unregister WGCM tasks. 33 */ 34 extern int wgcm_ctl(unsigned long flags, unsigned long server_tid); 35 36 extern void wgcm_do_exit(struct task_struct *tsk); 37 extern void wgcm_clear_child(struct task_struct *p); 38 extern void wgcm_activate_task(struct task_struct *p); 39 extern void wgcm_deactivate_task(struct task_struct *p, int flags); 40 #else wgcm_ctl(unsigned long flags,unsigned long server_tid)41static inline int wgcm_ctl(unsigned long flags, unsigned long server_tid) 42 { 43 return -EOPNOTSUPP; 44 } 45 wgcm_do_exit(struct task_struct * tsk)46static inline void wgcm_do_exit(struct task_struct *tsk) 47 { 48 } 49 wgcm_clear_child(struct task_struct * p)50static inline void wgcm_clear_child(struct task_struct *p) 51 { 52 } 53 wgcm_activate_task(struct task_struct * p)54static inline void wgcm_activate_task(struct task_struct *p) 55 { 56 } 57 wgcm_deactivate_task(struct task_struct * p,int flags)58static inline void wgcm_deactivate_task(struct task_struct *p, int flags) 59 { 60 } 61 #endif /* CONFIG_WGCM */ 62 63 #endif /* _LINUX_WGCM_H */ 64