Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp1005982rbb; Sun, 25 Feb 2024 14:56:10 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVWPBHZs0Z9IYjqlGfNFkMgRh+ywnX2I4y0Wxmxje5G1WiAVmluhQ9hVj/3VlDsyUhxw+kwwh2pWtYmxRoZXw3P4EuE+3RGLtZeC826Pw== X-Google-Smtp-Source: AGHT+IE777WhYlXylzo2zMy2SdZFiKn0f/BF6QrLCSlD09ze+Jn4Hul1CzL9Zvi5w4ZJShNpECyL X-Received: by 2002:a17:902:d2c1:b0:1dc:a84b:e83c with SMTP id n1-20020a170902d2c100b001dca84be83cmr313497plc.25.1708901770009; Sun, 25 Feb 2024 14:56:10 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708901769; cv=pass; d=google.com; s=arc-20160816; b=ngQYtvvgdlpt8HW052aEi6mG1KTryb6n/QktbMBnbz28oFD5OJwp4YUzs3u02x+gMI UdzhIvT+LcCQ/s6eVsDaUPrmObM2g3JPOjYdm1tq/sFkiWLglCLTLshHLEqGhG2NaFFl +G/X/E3ME9Cl+i9VtvOkmF50p4PFNiceYvepf2+Mt3wMfiuf0UAG/v6c+aN0fYV3oYAJ /Y/mLSTW0p+QOHNB9kXimm8lvhg/V0rQaYb21odMphBOskbKgYKIKlDjM+wATq81lSra AeVV9M5Pd8t9hsF/bGTNw2gRqO3enmf5EwOIo8jocuK0mKpQlfobho+pgmkBP5IfiR3C T5Kw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=KP57oNgiiWc8bUQWDLBfL9MmrbUo4nKOqFci7pn/N6E=; fh=9AYDxpIF3ws21qQDvjghHSFUuXpDdpq2Zh/SbnasVRo=; b=iK0VaQNTwGol+F4OeDCd+FQnLueHb6/GTayJNzBEmKqaYZx35l+19sta8mz0ElNIl3 PaYVMzwHoMYkn28AJ6SPfZBi19n7RUYqNNgf4fopOAwBwuEHBmGXlVSwhQqx4r94sx2I 3/HGgRib1alX6oXj1CdPNV+bABYLwJB1HJEnF7AoERPGuVs4EX79KEnRswM0KctmT/dK ctn+Zp380cbabpoKPww3HvhKFQHgCu5hetxUhc1pxvS964e3CGUwonTw82q7qzxMUwTa E7Sh573Fug08IF1EjL+JrAV8XZzpw7RhDClkZE1QuZuIqoVJC5poO0nf69fbva0bBjzw +ckQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=aJiqOwTa; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-80331-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-80331-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id d2-20020a170902cec200b001dca6272e21si315024plg.36.2024.02.25.14.56.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 25 Feb 2024 14:56:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-80331-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=aJiqOwTa; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-80331-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-80331-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id B06BA281F60 for ; Sun, 25 Feb 2024 22:56:09 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E8B791CA8B; Sun, 25 Feb 2024 22:55:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="aJiqOwTa" 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 133D41C6BC for ; Sun, 25 Feb 2024 22:55:22 +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=1708901723; cv=none; b=lJFCny5mlXn27ZBYuzshyZrZlr1gfLZ4l/UiA/akgJA1QXiNQLqgdYNbXvQGtBh6GWVt6bkTzMKk0Zf7rhiB0lQ+86xlSesxBo+UAAmhfES5Cy+pyrlrWwPhds32fDeMNRg45Loy6Ylu2rO1m0Szk27KfjDduDR2HiaJJMoTARU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708901723; c=relaxed/simple; bh=Uf94OwcRiSANlW0Oxi4zepCxsB0vE767pi+Mh6tUbYM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=n7P7IT1VN6kitmSr63ZlX7HC0lxRFm+fjzCa7NuPm+oNeWEYUsKmebP/M0Q1Uz6LIzP6En/cTcpPlNpXm2NULgoyJgxYs3iKOfBLgeIpiO3ktOgEbB7ZTH5pAvapCkE8wi33cCBx9h9IM8TJ4lx5Wwy7se43s25ijqQJZsOH17M= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=aJiqOwTa; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1B472C433A6; Sun, 25 Feb 2024 22:55:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708901722; bh=Uf94OwcRiSANlW0Oxi4zepCxsB0vE767pi+Mh6tUbYM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aJiqOwTaNKs7nT10lRqYCUxxCsw5cqZ7uUhn3K1lUaPPznGvnTAGwOlIUPDQKGOO7 3Lj6mO7SyUuCzZaY+mNUO/wFcZefZAVaXOlqGFZ3EefthIm7999koKBPdyuwGls+sd f9Iyk600QRuw8EGYW5ltYs6015SsgJbGq3cnRqC88BBNgliUNVbt4pOa47KZjMbm+W u1wA6R/ipUJIm8r5yspWO3h64j93F2h4U0+348IdeBeEfGpoSwDLroO/ViiscWGOHN pN/bIIywPRE2IKqlcQpNGpBshwU7kjss/0vDItHoPZPjH7mkphwaKFU6AstZOopE5m Wwt62ZVpnUxGA== From: Frederic Weisbecker To: LKML Cc: Frederic Weisbecker , Thomas Gleixner , Ingo Molnar , Anna-Maria Behnsen , Peng Liu , Joel Fernandes Subject: [PATCH 04/16] tick: Use IS_ENABLED() whenever possible Date: Sun, 25 Feb 2024 23:54:56 +0100 Message-ID: <20240225225508.11587-5-frederic@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240225225508.11587-1-frederic@kernel.org> References: <20240225225508.11587-1-frederic@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Avoid ifdeferry if it can be converted to IS_ENABLED() whenever possible Reviewed-by: Thomas Gleixner Signed-off-by: Frederic Weisbecker --- kernel/time/tick-common.c | 4 +--- kernel/time/tick-sched.c | 14 +++++--------- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/kernel/time/tick-common.c b/kernel/time/tick-common.c index e9138cd7a0f5..0084e1ae2583 100644 --- a/kernel/time/tick-common.c +++ b/kernel/time/tick-common.c @@ -111,15 +111,13 @@ void tick_handle_periodic(struct clock_event_device *dev) tick_periodic(cpu); -#if defined(CONFIG_HIGH_RES_TIMERS) || defined(CONFIG_NO_HZ_COMMON) /* * The cpu might have transitioned to HIGHRES or NOHZ mode via * update_process_times() -> run_local_timers() -> * hrtimer_run_queues(). */ - if (dev->event_handler != tick_handle_periodic) + if (IS_ENABLED(CONFIG_TICK_ONESHOT) && dev->event_handler != tick_handle_periodic) return; -#endif if (!clockevent_state_oneshot(dev)) return; diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c index 27aaecb2e50c..4e34967edc0d 100644 --- a/kernel/time/tick-sched.c +++ b/kernel/time/tick-sched.c @@ -186,7 +186,6 @@ static void tick_sched_do_timer(struct tick_sched *ts, ktime_t now) { int cpu = smp_processor_id(); -#ifdef CONFIG_NO_HZ_COMMON /* * Check if the do_timer duty was dropped. We don't care about * concurrency: This happens only when the CPU in charge went @@ -197,13 +196,13 @@ static void tick_sched_do_timer(struct tick_sched *ts, ktime_t now) * If nohz_full is enabled, this should not happen because the * 'tick_do_timer_cpu' CPU never relinquishes. */ - if (unlikely(tick_do_timer_cpu == TICK_DO_TIMER_NONE)) { + if (IS_ENABLED(CONFIG_NO_HZ_COMMON) && + unlikely(tick_do_timer_cpu == TICK_DO_TIMER_NONE)) { #ifdef CONFIG_NO_HZ_FULL WARN_ON_ONCE(tick_nohz_full_running); #endif tick_do_timer_cpu = cpu; } -#endif /* Check if jiffies need an update */ if (tick_do_timer_cpu == cpu) @@ -230,7 +229,6 @@ static void tick_sched_do_timer(struct tick_sched *ts, ktime_t now) static void tick_sched_handle(struct tick_sched *ts, struct pt_regs *regs) { -#ifdef CONFIG_NO_HZ_COMMON /* * When we are idle and the tick is stopped, we have to touch * the watchdog as we might not schedule for a really long @@ -239,7 +237,7 @@ static void tick_sched_handle(struct tick_sched *ts, struct pt_regs *regs) * idle" jiffy stamp so the idle accounting adjustment we do * when we go busy again does not account too many ticks. */ - if (ts->tick_stopped) { + if (IS_ENABLED(CONFIG_NO_HZ_COMMON) && ts->tick_stopped) { touch_softlockup_watchdog_sched(); if (is_idle_task(current)) ts->idle_jiffies++; @@ -250,7 +248,7 @@ static void tick_sched_handle(struct tick_sched *ts, struct pt_regs *regs) */ ts->next_tick = 0; } -#endif + update_process_times(user_mode(regs)); profile_tick(CPU_PROFILING); } @@ -1587,10 +1585,8 @@ void tick_cancel_sched_timer(int cpu) ktime_t idle_sleeptime, iowait_sleeptime; unsigned long idle_calls, idle_sleeps; -# ifdef CONFIG_HIGH_RES_TIMERS - if (ts->sched_timer.base) + if (IS_ENABLED(CONFIG_HIGH_RES_TIMERS) && ts->sched_timer.base) hrtimer_cancel(&ts->sched_timer); -# endif idle_sleeptime = ts->idle_sleeptime; iowait_sleeptime = ts->iowait_sleeptime; -- 2.43.0