Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp3709671rdh; Tue, 28 Nov 2023 01:24:33 -0800 (PST) X-Google-Smtp-Source: AGHT+IExGKY2Z84BK9ndjzqWrGD7waLNiAt/1buMwUOHFUPVWK464KRpXoqbKyOfG2nlgtGZi3z+ X-Received: by 2002:a17:90b:350d:b0:285:b239:f4ed with SMTP id ls13-20020a17090b350d00b00285b239f4edmr8419240pjb.34.1701163473091; Tue, 28 Nov 2023 01:24:33 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1701163473; cv=pass; d=google.com; s=arc-20160816; b=Wt5YIZ9FRyWYVXXEOcD1Yr5GACGVdprD7asENqF7mfZsv0vy2RjdR5c9blpfnteLVV gvJI3l/W9uhddjFBU+G6WVYy+q0M370nAACOKL5N5k4Kl0TVvM6tVikiMARuCMaZNs9v 2+QP9knjZMam1UoFrHkkA7zjL409patJ9AaUONPvbRvXvxvasw794spviwXkKHOrm75K RYHqSeT2w4YXrI3uCwhlLgT6nvzm1wKujFu9A4h5UtxwcmKVqh9VOmI10CphmHlaWcUA Htgcxe1anaIyrKE3B0b5ziNQVojzT8HfZ2tS98nKivhQK1k3xsxvyl+TJ+3L+SGO6d+M iK2g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:from :dkim-signature; bh=4kEb4vVlqMF9z+4MBpf5lIv4WR04bwkZdLBmgTCGfco=; fh=PCB+y5RwBd196+WJ8zMUAGgWXf/mKqOmrKDlRz8J89E=; b=M8dAA7ZEB+Et1AsZWtkqpV2ZW8ZiXzKUg3+2uKGyDk2j4rLbQZhFNrHwy2frYGf7m8 hj/6+ynbX1ZvnsSb3qRha8tef1aNflktDQ8TeG3nDreu2x+BLIZVSSY0to3KUpFZZHR0 DK+gHBRv01nRXrz2wz1scR15im3LME+T8Q/0u1JlToXYlsCcPZJE9EbQB7vkEGlRFxLG 3GyCnsUSTW9fK7rBz0vw3D8g0Rd9Mo2OQBIDdtSyzAiVCyI/q3WQ2eGur1ZGynlmstNr An7PHst6Q50KrQIYq8MDaccraHN3PMx8d1uV6B1a5iSBwZ6ZuvVJia5Oz/ZrDJbOGfXp aKfw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@hotmail.com header.s=selector1 header.b=SWYkHcX7; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=hotmail.com Return-Path: Received: from pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id om9-20020a17090b3a8900b00285ebeed85fsi2469879pjb.123.2023.11.28.01.24.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Nov 2023 01:24:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@hotmail.com header.s=selector1 header.b=SWYkHcX7; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=hotmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id A60C281A8A8D; Tue, 28 Nov 2023 01:24:29 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234828AbjK1JYN (ORCPT + 99 others); Tue, 28 Nov 2023 04:24:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34662 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230044AbjK1JYM (ORCPT ); Tue, 28 Nov 2023 04:24:12 -0500 Received: from JPN01-TYC-obe.outbound.protection.outlook.com (mail-tycjpn01olkn2073.outbound.protection.outlook.com [40.92.99.73]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C7AF5D0 for ; Tue, 28 Nov 2023 01:24:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cszRAVam13KzLSpyri0Z+neo5RcFBmyBQL1JYI0HEhZsGV+nzGA923CNIh5ApASvMuAVAFYuGkGZONBcIIko7YZN7c/xoyftgYEIq+/HX2nLlINfKAHJsxBt/Z50afxOwrXweid56aij9StHWJEAH+X6nnvd6pdZ6YKzdtTGBNFsTr+7Of45qfIXdvDIOM423E0i/5fU5ulARxoteVctUcSqvwPOnWIiU0wBwRogECTUI+dyOujEI1zr+HTg5B6yv7osFNmP84EatvQtfetd9PzRt4FhY4+EQ+lNF/cDeTZ+58yqh3EtwCY/hNoUUxnHMa37xeOQ8x7aTzhWl67fLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=4kEb4vVlqMF9z+4MBpf5lIv4WR04bwkZdLBmgTCGfco=; b=UYsE6V3VYYSzgKDatut7WMltz0lUb5QV+lPI4NaZaAAVVYgw1m22ZsEBgpuWzywldxqN0am/GpzMkwwQKi86nLFxbfg5nvhsy/lSUEKu9FbKwsdc6Ek1RZLneNTzKFT9lvEzCGnslpOK1Aim1j7re1gwHIAyCAnie8ZSufqaBnXj2cImuFgDkHta7gAvcCydjW2rVUUSpW+NV3hTz0bm3rbGN2aosyp2qP/Un7wIku/nGhztaJb8w8PbaRe38JEjIRbSwap3IMbqK8LBAkIWEYrfjMjI6HaG3KuO4gMNvpNOEHQ1ol5JuEjPuQ6gnS2UxEraYxFtpEhvhs1zc98kCA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hotmail.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=4kEb4vVlqMF9z+4MBpf5lIv4WR04bwkZdLBmgTCGfco=; b=SWYkHcX7u8C94pm5cpqWpaQzaUXgjMdYnSDecf8I0MSZKAeskpZpW9G+U/cGnCRXntYxiB76EXSLi5hkh+F89ipMwzgcHn/Oj0aIYrg5Ivfg/55cGCYDT5RB7H3+Y3ZZ2GB5R1qoBmR8zJLic2vCwUMBcwKqwB0vNXMMpQeJQCNRX4LFZVyNCOanNdHzBx/ryiJGSPigu/xJAoeQJiSUFNmdotOPbY6KjwcZNDekaXS5LOoyV8O6WjNI1e9AFrf+vP7Axg03brRrwN3jwadfFVgpXWOoRfMQ96dzyv2khKadvJ3mLHfQHrB6WfHlWqV23eqPXeyIljYtUaBjT7YMMg== Received: from TYCP286MB2146.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:158::13) by TY1P286MB3405.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:2e2::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7025.29; Tue, 28 Nov 2023 09:24:15 +0000 Received: from TYCP286MB2146.JPNP286.PROD.OUTLOOK.COM ([fe80::a621:9714:c1cf:e4f0]) by TYCP286MB2146.JPNP286.PROD.OUTLOOK.COM ([fe80::a621:9714:c1cf:e4f0%7]) with mapi id 15.20.7025.022; Tue, 28 Nov 2023 09:24:15 +0000 From: Peng Liu Cc: frederic@kernel.org, tglx@linutronix.de, mingo@kernel.org, linux-kernel@vger.kernel.org, liupeng17@lenovo.com Subject: [PATCH v2 2/2] tick/nohz: Remove duplicate between tick_nohz_lowres_handler() and tick_nohz_highres_handler() Date: Tue, 28 Nov 2023 17:24:13 +0800 Message-ID: X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231127083118.145704-1-pngliu@hotmail.com> References: <20231127083118.145704-1-pngliu@hotmail.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-TMN: [g3cg2rXksPg0mwyiatDHncz3IuPGL2VA] X-ClientProxiedBy: TYWPR01CA0015.jpnprd01.prod.outlook.com (2603:1096:400:a9::20) To TYCP286MB2146.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:158::13) X-Microsoft-Original-Message-ID: <20231128092413.160451-1-pngliu@hotmail.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYCP286MB2146:EE_|TY1P286MB3405:EE_ X-MS-Office365-Filtering-Correlation-Id: 788d8520-7c0f-4b5d-6195-08dbeff3ca73 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Hz23AqrVKKmuXSNVkSDPdHZmKpwfUxpgPZCf6O3PH2HuL3EuejFCq8h9Bj+1A9P7n3Jo/+9kI0kZ7MIfnq1sqggN4Fy7cVpyVDJPtf+QE8bMYLkVeF+qPZ5aGrCHGu0SZJf+Dt8Ks0DpiEBgeOsQjjFVfN25CnUhChqDroIJXsFKRdYNP4Z8yt/+DC2Do7WjF4ZUoMkoHEybVEwDyp8+xwLPmk5DhaCAAZuRIv5ZJULUGUXDaUM2yWL6U7W5Eck7wV1ROS5467gw5yDnvsG5dRh06v/9NJaRjU6z3dxfxyZ6E/QlGEX3qeGRnBrVi5AhCRxEJUZefHCSEWFZ2W2KDGrEA6yHDrM8xS5ZRF0L8sh4i6jKDSyS0hVD0jd08TX1tX+ZD9QuEECZk8qMr7KEczT8qtASGVq2J36bWm8gxsyt8IKHs8N4kL/c+5L6i3bhVDxTeujsi9xC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?Q?1q6QOvT8PhKQTC3cJHZnUqHPHVxVDz6HmX58Bhg3LWz4BFv5ZCQDHJYzAwfF?= =?us-ascii?Q?3iMTecvQcND0PeIfqIgVZYpbCtIXYXnKjyxsZimaw6OQMqEnnUaP6lmDmybX?= =?us-ascii?Q?2usrGjgkVjrdTTq0gIzP27xW1sjm2xkJHw39sYKsaP2+fZd6BaPuItsZ6yOG?= =?us-ascii?Q?edr6/A4018Inu8WatrBsUSW7SOXa7NaKxbJNQeQQHK2nMAFD8RmbzN+E+H9e?= =?us-ascii?Q?e7EPlfUDBRQtdbzuNBfZl1+5h/yR12aMuB+7FB7Widmg2cnSM42UeYY9evwd?= =?us-ascii?Q?OuLU2Bse8K9+HWlG1nmP9Szg9dKyE5dZxnEo6sfs4TSq57stiekfKq1GXX5W?= =?us-ascii?Q?PRAUuwMwutjbqkpvL/+renfmmvToc1cK+aPFbHtSJyQ2MZpt9I41wZnM2hBK?= =?us-ascii?Q?D8VrxwwKc+QhuwERe8VY3qteKWefHDRiwibybK53pT/oo92bGCp34uB0oA75?= =?us-ascii?Q?7Yn8JcqERNvaPG/DGmbNOnIK5qftG8s7nDTxJQ=3D=3D?= X-OriginatorOrg: sct-15-20-4755-11-msonline-outlook-05f45.templateTenant X-MS-Exchange-CrossTenant-Network-Message-Id: 788d8520-7c0f-4b5d-6195-08dbeff3ca73 X-MS-Exchange-CrossTenant-AuthSource: TYCP286MB2146.JPNP286.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Nov 2023 09:24:15.8717 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: TY1P286MB3405 X-Spam-Status: No, score=0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FORGED_HOTMAIL_RCVD2,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Tue, 28 Nov 2023 01:24:29 -0800 (PST) From: Peng Liu tick_nohz_lowres_handler() does the same work as tick_nohz_highres_handler() plus the clockevent device reprogramming, so should reuse the latter. Signed-off-by: Peng Liu --- Changes in v2: - Fix build warning: Function parameter or member 'mode' not described in 'tick_setup_sched_timer' - Fix build error: use of undeclared identifier 'tick_nohz_highres_handler' - Fix build error: use of undeclared identifier 'sched_skew_tick' --- kernel/time/tick-sched.c | 28 ++++++---------------------- 1 file changed, 6 insertions(+), 22 deletions(-) diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c index 96fcf5cb1b49..c2142b38c31d 100644 --- a/kernel/time/tick-sched.c +++ b/kernel/time/tick-sched.c @@ -1383,36 +1383,25 @@ void tick_nohz_idle_exit(void) local_irq_enable(); } +static enum hrtimer_restart tick_nohz_highres_handler(struct hrtimer *timer); + /* * In low-resolution mode, the tick handler must be implemented directly * at the clockevent level. hrtimer can't be used instead, because its * infrastructure actually relies on the tick itself as a backend in * low-resolution mode (see hrtimer_run_queues()). * - * This low-resolution handler still makes use of some hrtimer APIs meanwhile - * for convenience with expiration calculation and forwarding. + * This low-resolution handler still reuse tick_nohz_highres_handler() since + * most of the work is independent of the clockevent level. */ static void tick_nohz_lowres_handler(struct clock_event_device *dev) { struct tick_sched *ts = this_cpu_ptr(&tick_cpu_sched); - struct pt_regs *regs = get_irq_regs(); - ktime_t now = ktime_get(); dev->next_event = KTIME_MAX; - tick_sched_do_timer(ts, now); - tick_sched_handle(ts, regs); - - /* - * In dynticks mode, tick reprogram is deferred: - * - to the idle task if in dynticks-idle - * - to IRQ exit if in full-dynticks. - */ - if (likely(!ts->tick_stopped)) { - hrtimer_forward(&ts->sched_timer, now, TICK_NSEC); + if (likely(tick_nohz_highres_handler(&ts->sched_timer) == HRTIMER_RESTART)) tick_program_event(hrtimer_get_expires(&ts->sched_timer), 1); - } - } static inline void tick_nohz_activate(struct tick_sched *ts, int mode) @@ -1481,10 +1470,7 @@ void tick_irq_enter(void) tick_nohz_irq_enter(); } -/* - * High resolution timer specific code - */ -#ifdef CONFIG_HIGH_RES_TIMERS +#if defined CONFIG_NO_HZ_COMMON || defined CONFIG_HIGH_RES_TIMERS /* * We rearm the timer until we get disabled by the idle code. * Called with interrupts disabled. @@ -1519,9 +1505,7 @@ static enum hrtimer_restart tick_nohz_highres_handler(struct hrtimer *timer) return HRTIMER_RESTART; } -#endif /* HIGH_RES_TIMERS */ -#if defined CONFIG_NO_HZ_COMMON || defined CONFIG_HIGH_RES_TIMERS static int sched_skew_tick; static int __init skew_tick(char *str) -- 2.34.1