Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754396AbbHaToY (ORCPT ); Mon, 31 Aug 2015 15:44:24 -0400 Received: from g4t3425.houston.hp.com ([15.201.208.53]:42565 "EHLO g4t3425.houston.hp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754373AbbHaToW (ORCPT ); Mon, 31 Aug 2015 15:44:22 -0400 Message-ID: <1441050020.16209.34.camel@j-VirtualBox> Subject: Re: [PATCH 1/3] timer: Optimize fastpath_timer_check() From: Jason Low To: Davidlohr Bueso Cc: Peter Zijlstra , Ingo Molnar , Thomas Gleixner , Oleg Nesterov , "Paul E. McKenney" , linux-kernel@vger.kernel.org, Frederic Weisbecker , Steven Rostedt , Andrew Morton , Terry Rudd , Rik van Riel , Scott J Norton , jason.low2@hp.com Date: Mon, 31 Aug 2015 12:40:20 -0700 In-Reply-To: <1441034105.1831.39.camel@stgolabs.net> References: <1440559068-29680-1-git-send-email-jason.low2@hp.com> <1440559068-29680-2-git-send-email-jason.low2@hp.com> <1441034105.1831.39.camel@stgolabs.net> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.2.3-0ubuntu6 Content-Transfer-Encoding: 7bit Mime-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2129 Lines: 53 On Mon, 2015-08-31 at 08:15 -0700, Davidlohr Bueso wrote: > On Tue, 2015-08-25 at 20:17 -0700, Jason Low wrote: > > In fastpath_timer_check(), the task_cputime() function is always > > called to compute the utime and stime values. However, this is not > > necessary if there are no per-thread timers to check for. This patch > > modifies the code such that we compute the task_cputime values only > > when there are per-thread timers set. > > > > Signed-off-by: Jason Low > > Reviewed-by: Davidlohr Bueso Thanks David and Frederic. I want to mention that this patch has been slightly changed. As suggested by George, those extra utime, stime local variables are not needed anymore, and we should be able to directly call: task_cputime(tsk, &task_sample.utime, &task_sample.stime); --- diff --git a/kernel/time/posix-cpu-timers.c b/kernel/time/posix-cpu-timers.c index 892e3da..3a8c5b4 100644 --- a/kernel/time/posix-cpu-timers.c +++ b/kernel/time/posix-cpu-timers.c @@ -1117,16 +1117,13 @@ static inline int task_cputime_expired(const struct task_cputime *sample, static inline int fastpath_timer_check(struct task_struct *tsk) { struct signal_struct *sig; - cputime_t utime, stime; - - task_cputime(tsk, &utime, &stime); if (!task_cputime_zero(&tsk->cputime_expires)) { - struct task_cputime task_sample = { - .utime = utime, - .stime = stime, - .sum_exec_runtime = tsk->se.sum_exec_runtime - }; + struct task_cputime task_sample; + + task_cputime(tsk, &task_sample.utime, &task_sample.stime); + + task_sample.sum_exec_runtime = tsk->se.sum_exec_runtime; if (task_cputime_expired(&task_sample, &tsk->cputime_expires)) return 1; -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/