Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp3990313rdh; Tue, 28 Nov 2023 08:56:34 -0800 (PST) X-Google-Smtp-Source: AGHT+IH67nVWl7oa5miJBrYCihdtCPzsqQ4Z5Pggl8Rvp+LHg1vD/ivsMDp1Q5SopoUTYf1SyN64 X-Received: by 2002:a17:902:e750:b0:1cf:c02f:6cea with SMTP id p16-20020a170902e75000b001cfc02f6ceamr8396753plf.69.1701190594559; Tue, 28 Nov 2023 08:56:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701190594; cv=none; d=google.com; s=arc-20160816; b=qJQ4WjRwhnsOBLqtdsk2gTR0rknhuD5OrM0SaepY6VHkhWMQZK66v7ObH1JNz50IKv IseasF7IDtjO0/+SqloW1YNQUtljxRpIr9UmkKugH9z3qTwEZhzWG3K4emlTjzKKPFV4 DSTh9FDpU3f8h+R4VWtNSZeNVOSKWjPbS/+OlYoEqZcgcE/ivjaLZkFX1ufzJoIaEzn/ EGpRtGrxAOpQkh8PS1bBeUSjiXLNzX4Bra6udjzh9rW8TuBS0UH4nyF6t+n0svdnFBme sDA/oasOUgHlm4YReln8ADlww7+2aef78MIfe2bZwWIFEXP0H2eBhp+V3IXCgXZzGamR qNPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=yNUfklH5BYFE1DAj3vWrgq5uO0QEFmJgFPCNlkulx4s=; fh=gOsf/C9oGsx8mW0RFdSWIOnFVVE9a2kx3u0KdziicVw=; b=KB3JEXHgd9Kx6VU9/iYAQ3sY2YvuENaNoqBMqGBPRbnXxhFGbgcwZSisMXomVzt0sw /T/Ojeor53FeBP0JmMxs0l/THaBqpBM9w/dbr2gNboFoxzQSfoCIHG8oP5oTEqIcxPFX /I17ckcifcAbuM+sJkgTEERMxe65LGMdzJXkzS/NknVSyKgy0mbwOPK8f7+JXV+V+1qe Md19MQ6eEbEOWJQ83QG3M8j0KGRghY2S1TUoCvC32Nl77uK+ivKjfidB18SW/ynaOALt tHnOLEUG7AaHrej8ktkurEvhJHlC2bVN9SLG+eU7h51qivOM9XlR637Qr+ePqWVySl+f KjYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=TI7N3S3K; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 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 morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id d17-20020a170902ef1100b001cfee4c128asi2925014plx.356.2023.11.28.08.56.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Nov 2023 08:56:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=TI7N3S3K; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 4DD3080BE7D1; Tue, 28 Nov 2023 08:56:32 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345035AbjK1Q4J (ORCPT + 99 others); Tue, 28 Nov 2023 11:56:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32914 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345029AbjK1Q4I (ORCPT ); Tue, 28 Nov 2023 11:56:08 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 83812D4F for ; Tue, 28 Nov 2023 08:56:14 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C737FC433C7; Tue, 28 Nov 2023 16:56:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1701190574; bh=OY8Ow22MyrAVlMRwF371bD3qmtjpS3+hhDNNRpCJdKM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=TI7N3S3KUs661mm3dASe/zGx52toUNAAkHDMpzBCiz8DEW/vqQKomWD3aanAbrW85 T98u0NPMzpsiEPEUfwLYwFqle00plhbYOtvX6lFQdyZRPvoBFjsjB54VTM/Hxa4FIO btogyRh8y7cidA/7UmLGzL8B8EVZ94VvOiiunXLzkSKm7tkTVMxOs8ZidAW4zgXw/n 8MVmuAKtsgu+eEMofEXAJ/jxDiQJKAQv+7bHPu5Wyn6FAfk9BBl/CKTVPSpQNDSY+3 mgPI10b+cQ7ykyW4VQyrM/nYvUV8TfqdNz3F3nCCu1trbkmXUF3nsZDzGM2oCSlBX2 Z/BZVP1FXvrkQ== Date: Tue, 28 Nov 2023 17:56:11 +0100 From: Frederic Weisbecker To: Peng Liu Cc: tglx@linutronix.de, mingo@kernel.org, linux-kernel@vger.kernel.org, liupeng17@lenovo.com Subject: Re: [PATCH v2 1/2] tick/nohz: Remove duplicate between tick_nohz_switch_to_nohz() and tick_setup_sched_timer() Message-ID: References: <20231127083049.145447-1-pngliu@hotmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email 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 (morse.vger.email [0.0.0.0]); Tue, 28 Nov 2023 08:56:32 -0800 (PST) On Tue, Nov 28, 2023 at 05:23:54PM +0800, Peng Liu wrote: > @@ -1529,7 +1519,9 @@ 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 tick-sched.c is only ever built if CONFIG_TICK_ONESHOT=y and CONFIG_TICK_ONESHOT is basically (CONFIG_NO_HZ_COMMON || CONFIG_HIGH_RES_TIMERS) So probably the above is not needed and if you like you can even send a subsequent patch removing such ifdefs within this file :-) > static int sched_skew_tick; > > static int __init skew_tick(char *str) > @@ -1542,15 +1534,19 @@ early_param("skew_tick", skew_tick); > > /** > * tick_setup_sched_timer - setup the tick emulation timer > + * @mode: tick_nohz_mode to setup for > */ > -void tick_setup_sched_timer(void) > +void tick_setup_sched_timer(int mode) > { > struct tick_sched *ts = this_cpu_ptr(&tick_cpu_sched); > ktime_t now = ktime_get(); > > /* Emulate tick processing via per-CPU hrtimers: */ > hrtimer_init(&ts->sched_timer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS_HARD); > - ts->sched_timer.function = tick_nohz_highres_handler; > +#ifdef CONFIG_HIGH_RES_TIMERS > + if (mode == NOHZ_MODE_HIGHRES) > + ts->sched_timer.function = tick_nohz_highres_handler; > +#endif That ifdef could simply be removed. > > /* Get the next period (per-CPU) */ > hrtimer_set_expires(&ts->sched_timer, tick_init_jiffy_update()); > @@ -1564,12 +1560,15 @@ void tick_setup_sched_timer(void) > } That invisible part above is the skew_tick thing, which can probably work on low-res mode so why not but please tell about that in the changelog. > > hrtimer_forward(&ts->sched_timer, now, TICK_NSEC); Looks like this can be hrtimer_forward_now() and you can remove the now. > - hrtimer_start_expires(&ts->sched_timer, HRTIMER_MODE_ABS_PINNED_HARD); > - tick_nohz_activate(ts, NOHZ_MODE_HIGHRES); > +#ifdef CONFIG_HIGH_RES_TIMERS > + if (mode == NOHZ_MODE_HIGHRES) > + hrtimer_start_expires(&ts->sched_timer, HRTIMER_MODE_ABS_PINNED_HARD); > + else > +#endif And probably that ifdef could simply be turned to IS_ENABLED(CONFIG_HIGH_RES_TIMERS). Thanks!