--- Gnu-Mach/kern/task.h 2020/09/02 04:42:49 1.1.1.3 +++ Gnu-Mach/kern/task.h 2020/09/02 04:47:41 1.1.1.5 @@ -34,35 +34,37 @@ #ifndef _KERN_TASK_H_ #define _KERN_TASK_H_ -#include -#include -#include - #include #include #include #include #include +#include #include #include #include #include #include #include -#include +#include +#include -#if NET_ATM -typedef struct nw_ep_owned { - unsigned int ep; - struct nw_ep_owned *next; -} nw_ep_owned_s, *nw_ep_owned_t; -#endif +/* + * Task name buffer size. The size is chosen so that struct task fits + * into three cache lines. The size of a cache line on a typical CPU + * is 64 bytes. + */ +#define TASK_NAME_SIZE 32 struct task { /* Synchronization/destruction information */ decl_simple_lock_data(,lock) /* Task's lock */ int ref_count; /* Number of references to me */ - boolean_t active; /* Task has not been terminated */ + + /* Flags */ + unsigned int active:1, /* Task has not been terminated */ + /* boolean_t */ may_assign:1, /* can assigned pset be changed? */ + assign_active:1; /* waiting for may_assign */ /* Miscellaneous */ vm_map_t map; /* Address space description */ @@ -73,8 +75,6 @@ struct task { queue_head_t thread_list; /* list of threads */ int thread_count; /* number of threads */ processor_set_t processor_set; /* processor set for new threads */ - boolean_t may_assign; /* can assigned pset be changed? */ - boolean_t assign_active; /* waiting for may_assign */ /* User-visible scheduling information */ int user_stop_count; /* outstanding stops */ @@ -104,19 +104,25 @@ struct task { sample_control_t pc_sample; -#if NORMA_TASK - long child_node; /* if != -1, node for new children */ -#endif /* NORMA_TASK */ - #if FAST_TAS #define TASK_FAST_TAS_NRAS 8 vm_offset_t fast_tas_base[TASK_FAST_TAS_NRAS]; vm_offset_t fast_tas_end[TASK_FAST_TAS_NRAS]; #endif /* FAST_TAS */ -#if NET_ATM - nw_ep_owned_t nw_ep_owned; -#endif /* NET_ATM */ + /* Hardware specific data. */ + machine_task_t machine; + + /* Statistics */ + natural_t faults; /* page faults counter */ + natural_t zero_fills; /* zero fill pages counter */ + natural_t reactivations; /* reactivated pages counter */ + natural_t pageins; /* actual pageins couter */ + natural_t cow_faults; /* copy-on-write faults counter */ + natural_t messages_sent; /* messages sent counter */ + natural_t messages_received; /* messages received counter */ + + char name[TASK_NAME_SIZE]; }; #define task_lock(task) simple_lock(&(task)->lock) @@ -164,21 +170,22 @@ extern kern_return_t task_assign( extern kern_return_t task_assign_default( task_t task, boolean_t assign_threads); +extern kern_return_t task_set_name( + task_t task, + kernel_debug_name_t name); +extern void consider_task_collect(void); /* * Internal only routines */ -extern void task_init(); -extern void task_reference(); -extern void task_deallocate(); -extern kern_return_t task_hold(); -extern kern_return_t task_dowait(); -extern kern_return_t task_release(); -extern kern_return_t task_halt(); - -extern kern_return_t task_suspend_nowait(); -extern task_t kernel_task_create(); +extern void task_init(void); +extern void task_reference(task_t); +extern void task_deallocate(task_t); +extern void task_hold_locked(task_t); +extern kern_return_t task_hold(task_t); +extern kern_return_t task_dowait(task_t, boolean_t); +extern kern_return_t task_release(task_t); extern task_t kernel_task;