From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932664Ab2J2Uqb (ORCPT ); Mon, 29 Oct 2012 16:46:31 -0400 Received: from hrndva-omtalb.mail.rr.com ([71.74.56.122]:9739 "EHLO hrndva-omtalb.mail.rr.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757076Ab2J2Uiw (ORCPT ); Mon, 29 Oct 2012 16:38:52 -0400 X-Authority-Analysis: v=2.0 cv=KcBQQHkD c=1 sm=0 a=rXTBtCOcEpjy1lPqhTCpEQ==:17 a=mNMOxpOpBa8A:10 a=Ciwy3NGCPMMA:10 a=Y4x_QKceoAwA:10 a=5SG0PmZfjMsA:10 a=bbbx4UPp9XUA:10 a=meVymXHHAAAA:8 a=ViZkdgtUnW0A:10 a=pGLkceISAAAA:8 a=VwQbUJbxAAAA:8 a=Z4Rwk6OoAAAA:8 a=20KFwNOVAAAA:8 a=9AzMRrQhAAAA:8 a=NufY4J3AAAAA:8 a=KKAkSRfTAAAA:8 a=JfrnYn6hAAAA:8 a=ftUzEednAAAA:8 a=sozttTNsAAAA:8 a=EUspDBNiAAAA:8 a=VnNF1IyMAAAA:8 a=fh4mg5NFAAAA:8 a=5AB75Ri8bxmm_MEgFBYA:9 a=MSl-tDqOz04A:10 a=LI9Vle30uBYA:10 a=jbrJJM5MRmoA:10 a=jEp0ucaQiEUA:10 a=SxxB86fLhQ4A:10 a=re9sYKne76oA:10 a=WwgC8nHKvroA:10 a=3Rfx1nUSh_UA:10 a=QwxQZocgbLcA:10 a=x2szoZtqnggA:10 a=IG2fH9E8heMA:10 a=Im-eZXwrtqoA:10 a=jeBq3FmKZ4MA:10 a=Zh68SRI7RUMA:10 a=rXTBtCOcEpjy1lPqhTCpEQ==:117 X-Cloudmark-Score: 0 X-Originating-IP: 74.67.115.198 Message-Id: <20121029203847.815884461@goodmis.org> User-Agent: quilt/0.60-1 Date: Mon, 29 Oct 2012 16:27:19 -0400 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Andrew Morton , Thomas Gleixner , Peter Zijlstra , Clark Williams , Frederic Weisbecker , Li Zefan , Ingo Molnar , "Paul E. McKenney" , Mike Galbraith , Alessio Igor Bogani , Avi Kivity , Chris Metcalf , Christoph Lameter , Daniel Lezcano , Geoff Levand , Gilad Ben Yossef , Hakan Akkan , Kevin Hilman , Max Krasnyansky , Stephen Hemminger , Sven-Thorsten Dietrich Subject: [PATCH 08/32] nohz/cpuset: Dont stop the tick if posix cpu timers are running References: <20121029202711.062749374@goodmis.org> Content-Disposition: inline; filename=0008-nohz-cpuset-Don-t-stop-the-tick-if-posix-cpu-timers-.patch Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Frederic Weisbecker 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: Daniel Lezcano Cc: Geoff Levand Cc: Gilad Ben Yossef Cc: Hakan Akkan Cc: Ingo Molnar Cc: Kevin Hilman Cc: Max Krasnyansky Cc: Paul E. McKenney Cc: Peter Zijlstra Cc: Stephen Hemminger Cc: Steven Rostedt Cc: Sven-Thorsten Dietrich Cc: Thomas Gleixner --- include/linux/posix-timers.h | 1 + kernel/posix-cpu-timers.c | 12 ++++++++++++ kernel/time/tick-sched.c | 4 ++++ 3 files changed, 17 insertions(+) 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 125cb67..79d4c24 100644 --- a/kernel/posix-cpu-timers.c +++ b/kernel/posix-cpu-timers.c @@ -6,6 +6,7 @@ #include #include #include +#include #include #include #include @@ -1274,6 +1275,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 de3c8fe..0a5e650 100644 --- a/kernel/time/tick-sched.c +++ b/kernel/time/tick-sched.c @@ -21,6 +21,7 @@ #include #include #include +#include #include @@ -518,6 +519,9 @@ static bool can_stop_adaptive_tick(void) if (!sched_can_stop_tick()) return false; + if (posix_cpu_timers_running(current)) + return false; + /* Is there a grace period to complete ? */ if (rcu_pending(smp_processor_id())) return false; -- 1.7.10.4