Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp624953ybt; Mon, 6 Jul 2020 18:33:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw5KBip/2SXNMlSbXVYGL4ilqvsSDHn+bVfA1CKpEOvxI1bajmvcTBM3vdiJhzJiYrj4/lC X-Received: by 2002:a17:907:2163:: with SMTP id rl3mr43993939ejb.409.1594085625576; Mon, 06 Jul 2020 18:33:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594085625; cv=none; d=google.com; s=arc-20160816; b=xEHjsu6p7p1bz/i92ARsW/5LUwSWn+LFsznOf2sEnNTPw7ZBmv2XQyDf0y55XTwI2a v4jcDgYOAMul7a2BSRnI0/2qs78OeP2qruKFZCi2WDl72aynFRfuwoS0RaC2cwBQVsUs V4HB3qL2CYbhxGk+svF6+wtUOGuyU3E+asmGGE2kj+hyzkNUGiVjnbBbiCyAjQZwah5S slwHRRk62iPOvpyokb+8scleQLiVvdbj8XWwaJ6OjXlpHUI1bv5zAl4bdMTkKHzi6DLc Mr+mPrVaMRLiHImK6p//jYAtvT1XEhEuX0uD4czsjhlD1mcdS15Y4kSu6Bxv2rV8h+oI 82aQ== 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=gIUl/4Z3/IE4agOeER4m4S9Eje+wPBasv49N0qMhrpEMDrUotxn3WFTe3ndvnW4OSs 8DxVrrSrmHPh/rFTm4PnRbY2VF9UNkQ7s+PRGxQcbdKiYzbYvBAUdJzIJycVSqSI+PEV 8ixtbalxt4Atm7mFcQjTXsBqAuGhxjXTATC1YPfADM8GmuR4Ylm4cn107W+hc/n03dch JNRcj/ulFtMhUQy2G5g/csHEn39H3YrTKgHq3FQVbf/5BUVUipC9k6S190MFLqrzQ5Ya 8U2PPuNx7JTiyaFVvw2yEFBSZPWqWyUXUdoOmj6qXSzQm0A3+f019HX5T6bx404RBO3+ bP7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=jsqONnY3; 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 v6si15345766edy.149.2020.07.06.18.33.22; Mon, 06 Jul 2020 18:33:45 -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=jsqONnY3; 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 S1727886AbgGGBdJ (ORCPT + 99 others); Mon, 6 Jul 2020 21:33:09 -0400 Received: from mail.kernel.org ([198.145.29.99]:38532 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727064AbgGGBdI (ORCPT ); Mon, 6 Jul 2020 21:33:08 -0400 Received: from lenoir.home (lfbn-ncy-1-317-216.w83-196.abo.wanadoo.fr [83.196.152.216]) (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 AD68720708; Tue, 7 Jul 2020 01:33:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1594085587; bh=X8gtXEPhNZx3ZIBXS6b69iuGP95TvO4abhgwH9+3Tgc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jsqONnY3JQ6OgLZHokvQdN5NdaDd5iMs4wt17PqSME9wgg1mi7pD4cgqak3rnJ5VA HbAfYod1HWOYMx/tuYFFix1CJkVW0yBVsFJwDc2lqshLmZEfneRtg0TCGgyX0r0Q/s SNn0Dem70Dh3Ci5c9vXl0IV77UYfnmZe1b6uXMjU= From: Frederic Weisbecker To: Thomas Gleixner Cc: LKML , Frederic Weisbecker , Anna-Maria Gleixner , Peter Zijlstra , Juri Lelli Subject: [PATCH 1/9] timer: Move trigger_dyntick_cpu() to enqueue_timer() Date: Tue, 7 Jul 2020 03:32:45 +0200 Message-Id: <20200707013253.26770-2-frederic@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200707013253.26770-1-frederic@kernel.org> References: <20200707013253.26770-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