Received: by 2002:a05:7412:5112:b0:fa:6e18:a558 with SMTP id fm18csp1706099rdb; Thu, 25 Jan 2024 03:57:18 -0800 (PST) X-Google-Smtp-Source: AGHT+IEPQN+FVozP94BobZP4ikjhn7UtFk+PlOxAbsfyAuHV+opzCNBuFkPXfeX8/MMcCQ8QoOCQ X-Received: by 2002:ad4:4ee3:0:b0:685:7125:590c with SMTP id dv3-20020ad44ee3000000b006857125590cmr887201qvb.103.1706183836542; Thu, 25 Jan 2024 03:57:16 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706183836; cv=pass; d=google.com; s=arc-20160816; b=eoWvTL8V56ln5zHswNyjbGAW7SSP4Ijp8Ktb+xeuHxXL5Ry0G4sV1CKCLYcVTBmrhy OiKO1Hp2u94c4LOo98gQh9Wzo4YpUD/7NY+sfIGQYB8aJDAAQRTKy0FGLuwa/ER2RD1+ M9A2uVRX5dMgWMTOqxzQtP2uCr3yt6cGxNsGzZWW9s+aY00IGhYhBgiR3kd6LC5+pcQH C/ibrXMVfaaiaih2iaLg+bgYLXLEL4+22JTj/KbX7waWZZCfPeIdiVi77BkzwruVDPmc fSDBIvZQCHqbQ7waZa8Ifw08NF7ljAI8swDqEt4H+360cHu9qda14q+K/YuXeQhUck4P yE1w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=xNlTSFdxgCuPIGxWOz7JDL4L2+TxGqR+WmhGblGV40c=; fh=aC3yVQg7AFGfj7yzQQtEMB5VGuhMcWYMqWRxHmcsMU8=; b=u9G+KyFxRIUNeZD3rtV/AbH1biHbUU94WVYv1Qax5tcVOliBj1pF4zjGjsLftVKjpj yOjnlf+PgQ0KiKZ1dJyahpNzqiMK84gbQuaJ79NW0J66R7ob20Ka1OtG1iyNmcnSHIWO QV0cAY+KPPvBoFXWRfrqfYjRLCUqjRiqqUrC1T00X9S8x2FBIBgsbZyvgZZxaywLu86s PMVBD+UDEqotVfePpzEzXJGmgo2lkkyJm2X1FxAJFiJGG1JicSGv2+/5qjCL+QsKFJcj PQbRpEIws3cTBLg7aoZsWEVqKU8c4YOWTHznmGNZoaaZAXVibPJjETQdLywLRarMHOmd E8Hw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=PTbKPb73; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-38552-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-38552-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id x11-20020a0cb20b000000b00682bfd263c0si12902558qvd.347.2024.01.25.03.57.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Jan 2024 03:57:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-38552-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=PTbKPb73; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-38552-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-38552-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 4E9261C22A45 for ; Thu, 25 Jan 2024 11:57:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2191535F0C; Thu, 25 Jan 2024 11:57:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="PTbKPb73" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 42BA3321AF for ; Thu, 25 Jan 2024 11:57:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706183829; cv=none; b=RBqCZGBQtPcsBJjOrrw7c66tASProHs2Q9Ry7t3A3JDqx0Rus4nLKredimL9mcbGgzLLeUl0NGtIPgerbxAa7nKMBXX81yi6MlHtlR5BFcz2XIyvQ9b7XZ3qjNUigxB8IU0HYojiD3s1YY7iSG4U+cR6PivPVO8K88tvKssdlgI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706183829; c=relaxed/simple; bh=BGJEiMlRzKX4t3iaxmTX45WOVv5F3++XmfXJuH9STFA=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=XaZAFbzmAYMY0OG6oGaF168t7lifclHn2vf6HyCREQbOGxjfiJ35sL122aZmKIk5/B4uiEDIDGIqwtYl2vbZMI1JvF9lG3rByej4V+WOiqhnhDy8UNdYewEX0VywE5HNkyaDHJsr/EZNviY4kbkY1DL+wA0+dE9b6jKovCy53w0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=PTbKPb73; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4005BC433F1; Thu, 25 Jan 2024 11:57:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1706183828; bh=BGJEiMlRzKX4t3iaxmTX45WOVv5F3++XmfXJuH9STFA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=PTbKPb73asJ5zmYLUHClgodfcyX+3wmYXgyhUeOVMf6lQfOqwoYe/P141miqkwhID bv8nBLnzi/511BpJ8ghZIG5Oe62x2cjhcbt9Q/2klP/f79n32FevjzI3F0zqyBr1/u LCrkohXipQYpNVKUj7X7BDAJYvh/OdMzEzu7Pg3Mvs14G5kV3RLCGbgVhpe2v5EP00 XfbW3zpUGO9nNdLwNHsSL7Xwg72fT9XXEMikEbLxmT64QfeOGSQ9K5ntB4Ua89Flqx w5pzzDKcxySYWkvLYG5rKDr6Z51s0udZLpVg7YgSPzzh6DUKa0RbRsdY93QSA88Ccd hZhbjcbmnccSg== Date: Thu, 25 Jan 2024 12:57:05 +0100 From: Frederic Weisbecker To: Thomas Gleixner Cc: LKML , Peng Liu , Ingo Molnar , Anna-Maria Behnsen , Joel Fernandes Subject: Re: [PATCH 01/15] tick/nohz: Remove duplicate between tick_nohz_switch_to_nohz() and tick_setup_sched_timer() Message-ID: References: <20240124170459.24850-1-frederic@kernel.org> <20240124170459.24850-2-frederic@kernel.org> <87h6j1kc97.ffs@tglx> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87h6j1kc97.ffs@tglx> On Thu, Jan 25, 2024 at 10:12:20AM +0100, Thomas Gleixner wrote: > On Wed, Jan 24 2024 at 18:04, Frederic Weisbecker wrote: > > > > /** > > * 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 > > Adding > > #define tick_nohz_highres_handler NULL > > for CONFIG_HIGH_RES_TIMERS=n somewhere allows you to write that as: > > if (IS_ENABLED(CONFIG_HIGH_RES_TIMERS) && mode == NOHZ_MODE_HIGHRES) > ts->sched_timer.function = tick_nohz_highres_handler; So the next patch does: if (mode == NOHZ_MODE_HIGHRES) ts->sched_timer.function = tick_nohz_highres_handler; Because that condition only happens in CONFIG_HIGH_RES_TIMERS anyway and the function field exists in any case. I can move that to the current patch though. > > > + hrtimer_forward_now(&ts->sched_timer, TICK_NSEC); > > + if (mode == NOHZ_MODE_HIGHRES) > > Wants a (IS_ENABLED(HIGRES) && mode == ...) no? Hmm, indeed hrtimer_start_range_ns() called by hrtimer_start_expires() is only defined if CONFIG_HIGH_RES_TIMERS=y. I'll resend. Thanks. > > Thanks, > > tglx