From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752397Ab2LTSld (ORCPT ); Thu, 20 Dec 2012 13:41:33 -0500 Received: from mail-wg0-f49.google.com ([74.125.82.49]:60120 "EHLO mail-wg0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752394Ab2LTSlX (ORCPT ); Thu, 20 Dec 2012 13:41:23 -0500 From: Frederic Weisbecker To: LKML Cc: Frederic Weisbecker , Alessio Igor Bogani , Andrew Morton , Avi Kivity , Chris Metcalf , Christoph Lameter , Geoff Levand , Gilad Ben Yossef , Hakan Akkan , Ingo Molnar , "Paul E. McKenney" , Paul Gortmaker , Peter Zijlstra , Steven Rostedt , Thomas Gleixner Subject: [PATCH 23/24] nohz: Don't stop the tick if posix cpu timers are running Date: Thu, 20 Dec 2012 19:33:10 +0100 Message-Id: <1356028391-14427-24-git-send-email-fweisbec@gmail.com> X-Mailer: git-send-email 1.7.5.4 In-Reply-To: <1356028391-14427-1-git-send-email-fweisbec@gmail.com> References: <1356028391-14427-1-git-send-email-fweisbec@gmail.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If either a per thread or a per process posix cpu timer is running, don't stop the tick. TODO: restart the tick if it is stopped and a posix cpu timer is enqueued. Check we probably need a memory barrier for the per process posix timer that can be enqueued from another task of the group. Signed-off-by: Frederic Weisbecker Cc: Alessio Igor Bogani Cc: Andrew Morton Cc: Avi Kivity Cc: Chris Metcalf Cc: Christoph Lameter Cc: Geoff Levand Cc: Gilad Ben Yossef Cc: Hakan Akkan Cc: Ingo Molnar Cc: Paul E. McKenney Cc: Paul Gortmaker Cc: Peter Zijlstra Cc: Steven Rostedt Cc: Thomas Gleixner --- include/linux/posix-timers.h | 1 + kernel/posix-cpu-timers.c | 11 +++++++++++ kernel/time/tick-sched.c | 4 ++++ 3 files changed, 16 insertions(+), 0 deletions(-) diff --git a/include/linux/posix-timers.h b/include/linux/posix-timers.h index 042058f..97480c2 100644 --- a/include/linux/posix-timers.h +++ b/include/linux/posix-timers.h @@ -119,6 +119,7 @@ int posix_timer_event(struct k_itimer *timr, int si_private); void posix_cpu_timer_schedule(struct k_itimer *timer); void run_posix_cpu_timers(struct task_struct *task); +bool posix_cpu_timers_running(struct task_struct *tsk); void posix_cpu_timers_exit(struct task_struct *task); void posix_cpu_timers_exit_group(struct task_struct *task); diff --git a/kernel/posix-cpu-timers.c b/kernel/posix-cpu-timers.c index 3d58bd5..d3b46b3 100644 --- a/kernel/posix-cpu-timers.c +++ b/kernel/posix-cpu-timers.c @@ -1266,6 +1266,17 @@ static inline int fastpath_timer_check(struct task_struct *tsk) return 0; } +bool posix_cpu_timers_running(struct task_struct *tsk) +{ + if (!task_cputime_zero(&tsk->cputime_expires)) + return true; + + if (tsk->signal->cputimer.running) + return true; + + return false; +} + /* * This is called from the timer interrupt handler. The irq handler has * already updated our counts. We need to check if any timers fire now. diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c index 0c9281a..4f4fa13 100644 --- a/kernel/time/tick-sched.c +++ b/kernel/time/tick-sched.c @@ -21,6 +21,7 @@ #include #include #include +#include #include @@ -597,6 +598,9 @@ static bool can_stop_full_tick(int cpu) if (rcu_pending(cpu)) return false; + if (posix_cpu_timers_running(current)) + return false; + return true; } #endif -- 1.7.5.4