Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp191807ybt; Tue, 30 Jun 2020 18:11:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzIfTWbnabSEVndPciVD/tQsGVBz+75CyqWupZ0vVt1vfPxZwnLYN9BtC9CmKI1VIv7xicb X-Received: by 2002:a50:ab52:: with SMTP id t18mr26734133edc.195.1593565876128; Tue, 30 Jun 2020 18:11:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593565876; cv=none; d=google.com; s=arc-20160816; b=Oeli7eJBTm17/xCleJijgPch5AJC8IXgGBXAC8Fyt5U0sj91uBulKBDr45QBCuRzDb MXCoTsctOHXM/PBik9rs4+Ociqmnc2qTFxnXP++zRCgbok4Dp6GUIS15CV22vDcrCt8c QlaivKrfrR+ccNiKXy5DccoWggTHdXqUBAvIjKAoVeS/hj0/WCdqAe6+9LcUT5Phern0 kF9uUdAnFEU1kvqc/8oAHiUqJw1R+aQ6VInoU8xrzAh31McLxlLUSZFU0+TYjAy0Wos9 rEq+SkiB6KDWHfEACuojVWojc3CCJZ9BgSA/96nc1H8sMvSjHV9nVUtF4M1xCIeXQTkb hq+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=r0Hpt+S/0iYsIMmARNnRp1ceFFrArjQlAacWYYXCwUo=; b=PQuoAtVxNsFRIlofz7B8oqjc7nMMIXc/bLq3J1uOe+Y6pAMJdLcrhoApI3HLheddMN 2YiRugNaDj61amCPZBRDrDIy942mUv2rOQ2nntDiYaFk2Ml/C5xmHKtCJULpHY09mTn3 GCZJ1/NrdX7ZRY0s32uqq5jKh7DZOQ8h4CZJHPoZxGleMQjehbxQT2Swp7MKzsUfkl4R n8gWMSnrMFZM/pCbFu2yATC2Kruis5pOUAofU4eFrhBB9D7G0Jz6vFouDAI8KoRRd28T 5ggvzgcv8DuqVqhYCYbSczT9q8V62IkF0gGz7C2zDhmrJTozrJcaGE3rJ/BLpaBohYFE NmmQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=yIVcH5G9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y15si2887432edm.260.2020.06.30.18.10.53; Tue, 30 Jun 2020 18:11:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=yIVcH5G9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726444AbgGABKl (ORCPT + 99 others); Tue, 30 Jun 2020 21:10:41 -0400 Received: from mail.kernel.org ([198.145.29.99]:56936 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726123AbgGABKk (ORCPT ); Tue, 30 Jun 2020 21:10:40 -0400 Received: from lenoir.home (lfbn-ncy-1-996-218.w90-101.abo.wanadoo.fr [90.101.73.218]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 1CFB420771; Wed, 1 Jul 2020 01:10:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1593565839; bh=X8gtXEPhNZx3ZIBXS6b69iuGP95TvO4abhgwH9+3Tgc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yIVcH5G9TL/6LkQNxuZPFQ0VzmDw3uVrRubV5XDvnR7VuNot99h8HJ0XzyxWLb+dV OCWm0NYL5zOvI6sEk4n+wg5+FbPUNbSIaU5yL6sOXZ8+o6EQDDqFxgd4XjVwEctESa 0zwcrAjKvOkjLvisF7QuHqds9FMPuIdz1urmtLIg= From: Frederic Weisbecker To: Thomas Gleixner Cc: LKML , Frederic Weisbecker , Anna-Maria Gleixner , Peter Zijlstra , Juri Lelli Subject: [RFC PATCH 02/10] timer: Move trigger_dyntick_cpu() to enqueue_timer() Date: Wed, 1 Jul 2020 03:10:22 +0200 Message-Id: <20200701011030.14324-3-frederic@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200701011030.14324-1-frederic@kernel.org> References: <20200701011030.14324-1-frederic@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Consolidate the code by calling trigger_dyntick_cpu() from enqueue_timer() instead of calling it from all its callers. Signed-off-by: Frederic Weisbecker Cc: Peter Zijlstra Cc: Anna-Maria Gleixner Cc: Juri Lelli --- kernel/time/timer.c | 46 +++++++++++++++++++-------------------------- 1 file changed, 19 insertions(+), 27 deletions(-) diff --git a/kernel/time/timer.c b/kernel/time/timer.c index 9a838d38dbe6..4c977df3610b 100644 --- a/kernel/time/timer.c +++ b/kernel/time/timer.c @@ -529,29 +529,6 @@ static int calc_wheel_index(unsigned long expires, unsigned long clk) return idx; } -/* - * Enqueue the timer into the hash bucket, mark it pending in - * the bitmap and store the index in the timer flags. - */ -static void enqueue_timer(struct timer_base *base, struct timer_list *timer, - unsigned int idx) -{ - hlist_add_head(&timer->entry, base->vectors + idx); - __set_bit(idx, base->pending_map); - timer_set_idx(timer, idx); - - trace_timer_start(timer, timer->expires, timer->flags); -} - -static void -__internal_add_timer(struct timer_base *base, struct timer_list *timer) -{ - unsigned int idx; - - idx = calc_wheel_index(timer->expires, base->clk); - enqueue_timer(base, timer, idx); -} - static void trigger_dyntick_cpu(struct timer_base *base, struct timer_list *timer) { @@ -596,13 +573,29 @@ trigger_dyntick_cpu(struct timer_base *base, struct timer_list *timer) wake_up_nohz_cpu(base->cpu); } -static void -internal_add_timer(struct timer_base *base, struct timer_list *timer) +/* + * Enqueue the timer into the hash bucket, mark it pending in + * the bitmap and store the index in the timer flags. + */ +static void enqueue_timer(struct timer_base *base, struct timer_list *timer, + unsigned int idx) { - __internal_add_timer(base, timer); + hlist_add_head(&timer->entry, base->vectors + idx); + __set_bit(idx, base->pending_map); + timer_set_idx(timer, idx); + + trace_timer_start(timer, timer->expires, timer->flags); trigger_dyntick_cpu(base, timer); } +static void internal_add_timer(struct timer_base *base, struct timer_list *timer) +{ + unsigned int idx; + + idx = calc_wheel_index(timer->expires, base->clk); + enqueue_timer(base, timer, idx); +} + #ifdef CONFIG_DEBUG_OBJECTS_TIMERS static struct debug_obj_descr timer_debug_descr; @@ -1059,7 +1052,6 @@ __mod_timer(struct timer_list *timer, unsigned long expires, unsigned int option */ if (idx != UINT_MAX && clk == base->clk) { enqueue_timer(base, timer, idx); - trigger_dyntick_cpu(base, timer); } else { internal_add_timer(base, timer); } -- 2.26.2