From patchwork Thu Aug 1 14:32:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Gleixner X-Patchwork-Id: 11070861 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D37D913AC for ; Thu, 1 Aug 2019 14:38:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C608028515 for ; Thu, 1 Aug 2019 14:38:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BA27C28573; Thu, 1 Aug 2019 14:38:39 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 64DEC28515 for ; Thu, 1 Aug 2019 14:38:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732161AbfHAOiZ (ORCPT ); Thu, 1 Aug 2019 10:38:25 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:36227 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731467AbfHAOiY (ORCPT ); Thu, 1 Aug 2019 10:38:24 -0400 Received: from localhost ([127.0.0.1] helo=nanos.tec.linutronix.de) by Galois.linutronix.de with esmtp (Exim 4.80) (envelope-from ) id 1htCDW-0000m7-KX; Thu, 01 Aug 2019 16:38:06 +0200 Message-Id: <20190801143657.980489544@linutronix.de> User-Agent: quilt/0.65 Date: Thu, 01 Aug 2019 16:32:53 +0200 From: Thomas Gleixner To: LKML Cc: x86@kernel.org, Peter Zijlstra , Ingo Molnar , Sebastian Siewior , Anna-Maria Gleixner , Steven Rostedt , Julia Cartwright , Paul McKenney , Frederic Weisbecker , Oleg Nesterov , kvm@vger.kernel.org, Radim Krcmar , Paolo Bonzini , John Stultz , Andy Lutomirski , "Paul E. McKenney" Subject: [patch 3/5] posix-cpu-timers: Split run_posix_cpu_timers() References: <20190801143250.370326052@linutronix.de> MIME-Version: 1.0 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Split run_posix_cpu_timers() into two pieces, the hard interrupt context part and the actual timer evaluation/expiry part. The hard interrupt context part contains only the lockless fast path check and for now calls the expiry part as before. No functional change. Preparatory change to move the expiry part into task context. Signed-off-by: Thomas Gleixner Cc: Oleg Nesterov --- kernel/time/posix-cpu-timers.c | 37 +++++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 16 deletions(-) --- a/kernel/time/posix-cpu-timers.c +++ b/kernel/time/posix-cpu-timers.c @@ -1127,25 +1127,11 @@ static inline int fastpath_timer_check(s return 0; } -/* - * 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. - * Interrupts are disabled. - */ -void run_posix_cpu_timers(struct task_struct *tsk) +static void __run_posix_cpu_timers(struct task_struct *tsk) { - LIST_HEAD(firing); struct k_itimer *timer, *next; unsigned long flags; - - lockdep_assert_irqs_disabled(); - - /* - * The fast path checks that there are no expired thread or thread - * group timers. If that's so, just return. - */ - if (!fastpath_timer_check(tsk)) - return; + LIST_HEAD(firing); if (!lock_task_sighand(tsk, &flags)) return; @@ -1193,6 +1179,25 @@ void run_posix_cpu_timers(struct task_st } /* + * 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. + * Interrupts are disabled. + */ +void run_posix_cpu_timers(struct task_struct *tsk) +{ + lockdep_assert_irqs_disabled(); + + /* + * The fast path checks that there are no expired thread or thread + * group timers. If that's so, just return. + */ + if (!fastpath_timer_check(tsk)) + return; + + __run_posix_cpu_timers(tsk); +} + +/* * Set one of the process-wide special case CPU timers or RLIMIT_CPU. * The tsk->sighand->siglock must be held by the caller. */