forked from luck/tmp_suning_uos_patched
posix_timers: New API to prevent from stopping the tick when timers are running
Bring a new helper that the full dynticks infrastructure can call in order to know if it can safely stop the tick from the posix cpu timers subsystem point of view. Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com> Cc: Chris Metcalf <cmetcalf@tilera.com> Cc: Christoph Lameter <cl@linux.com> Cc: Geoff Levand <geoff@infradead.org> Cc: Gilad Ben Yossef <gilad@benyossef.com> Cc: Hakan Akkan <hakanakkan@gmail.com> Cc: Ingo Molnar <mingo@kernel.org> Cc: Kevin Hilman <khilman@linaro.org> Cc: Li Zhong <zhong@linux.vnet.ibm.com> Cc: Oleg Nesterov <oleg@redhat.com> Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Cc: Paul Gortmaker <paul.gortmaker@windriver.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Steven Rostedt <rostedt@goodmis.org> Cc: Thomas Gleixner <tglx@linutronix.de>
This commit is contained in:
parent
a85721601a
commit
555347f6c0
@ -122,6 +122,8 @@ void run_posix_cpu_timers(struct task_struct *task);
|
||||
void posix_cpu_timers_exit(struct task_struct *task);
|
||||
void posix_cpu_timers_exit_group(struct task_struct *task);
|
||||
|
||||
bool posix_cpu_timers_can_stop_tick(struct task_struct *tsk);
|
||||
|
||||
void set_process_cpu_timer(struct task_struct *task, unsigned int clock_idx,
|
||||
cputime_t *newval, cputime_t *oldval);
|
||||
|
||||
|
@ -155,6 +155,21 @@ static void bump_cpu_timer(struct k_itimer *timer,
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* task_cputime_zero - Check a task_cputime struct for all zero fields.
|
||||
*
|
||||
* @cputime: The struct to compare.
|
||||
*
|
||||
* Checks @cputime to see if all fields are zero. Returns true if all fields
|
||||
* are zero, false if any field is nonzero.
|
||||
*/
|
||||
static inline int task_cputime_zero(const struct task_cputime *cputime)
|
||||
{
|
||||
if (!cputime->utime && !cputime->stime && !cputime->sum_exec_runtime)
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline cputime_t prof_ticks(struct task_struct *p)
|
||||
{
|
||||
cputime_t utime, stime;
|
||||
@ -654,6 +669,17 @@ static void posix_cpu_timer_kick_nohz(void)
|
||||
{
|
||||
schedule_work(&nohz_kick_work);
|
||||
}
|
||||
|
||||
bool posix_cpu_timers_can_stop_tick(struct task_struct *tsk)
|
||||
{
|
||||
if (!task_cputime_zero(&tsk->cputime_expires))
|
||||
return true;
|
||||
|
||||
if (tsk->signal->cputimer.running)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
#else
|
||||
static inline void posix_cpu_timer_kick_nohz(void) { }
|
||||
#endif
|
||||
@ -1032,21 +1058,6 @@ static void check_cpu_itimer(struct task_struct *tsk, struct cpu_itimer *it,
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* task_cputime_zero - Check a task_cputime struct for all zero fields.
|
||||
*
|
||||
* @cputime: The struct to compare.
|
||||
*
|
||||
* Checks @cputime to see if all fields are zero. Returns true if all fields
|
||||
* are zero, false if any field is nonzero.
|
||||
*/
|
||||
static inline int task_cputime_zero(const struct task_cputime *cputime)
|
||||
{
|
||||
if (!cputime->utime && !cputime->stime && !cputime->sum_exec_runtime)
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Check for any per-thread CPU timers that have fired and move them
|
||||
* off the tsk->*_timers list onto the firing list. Per-thread timers
|
||||
|
Loading…
Reference in New Issue
Block a user