mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-28 17:41:50 +00:00
posix-cpu-timers: Create a container struct
Per task/process data of posix CPU timers is all over the place which makes the code hard to follow and requires ifdeffery. Create a container to hold all this information in one place, so data is consolidated and the ifdeffery can be confined to the posix timer header file and removed from places like fork. As a first step, move the cpu_timers list head array into the new struct and clean up the initializers and simplify fork. The remaining #ifdef in fork will be removed later. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Frederic Weisbecker <frederic@kernel.org> Link: https://lkml.kernel.org/r/20190821192920.819418976@linutronix.de
This commit is contained in:
parent
ab693c5a5e
commit
2b69942f90
6 changed files with 54 additions and 31 deletions
|
@ -62,6 +62,40 @@ static inline int clockid_to_fd(const clockid_t clk)
|
|||
return ~(clk >> 3);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_POSIX_TIMERS
|
||||
/**
|
||||
* posix_cputimers - Container for posix CPU timer related data
|
||||
* @cpu_timers: List heads to queue posix CPU timers
|
||||
*
|
||||
* Used in task_struct and signal_struct
|
||||
*/
|
||||
struct posix_cputimers {
|
||||
struct list_head cpu_timers[CPUCLOCK_MAX];
|
||||
};
|
||||
|
||||
static inline void posix_cputimers_init(struct posix_cputimers *pct)
|
||||
{
|
||||
INIT_LIST_HEAD(&pct->cpu_timers[0]);
|
||||
INIT_LIST_HEAD(&pct->cpu_timers[1]);
|
||||
INIT_LIST_HEAD(&pct->cpu_timers[2]);
|
||||
}
|
||||
|
||||
/* Init task static initializer */
|
||||
#define INIT_CPU_TIMERLISTS(c) { \
|
||||
LIST_HEAD_INIT(c.cpu_timers[0]), \
|
||||
LIST_HEAD_INIT(c.cpu_timers[1]), \
|
||||
LIST_HEAD_INIT(c.cpu_timers[2]), \
|
||||
}
|
||||
|
||||
#define INIT_CPU_TIMERS(s) \
|
||||
.posix_cputimers = { \
|
||||
.cpu_timers = INIT_CPU_TIMERLISTS(s.posix_cputimers), \
|
||||
},
|
||||
#else
|
||||
struct posix_cputimers { };
|
||||
#define INIT_CPU_TIMERS(s)
|
||||
#endif
|
||||
|
||||
#define REQUEUE_PENDING 1
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue