From mboxrd@z Thu Jan 1 00:00:00 1970 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 8358833F8C5 for ; Tue, 13 Jan 2026 10:02:23 +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=1768298543; cv=none; b=h+QsjUdDLUXkOAeR8IwExWPTWPmrHh0IBr+d7sfz18UVTgO5Pfg9ykqXchu4iw50jyDuGjx1C2Bq+n+qvA2TmpDbkxLXyu7P8qGcyjoIzLwtq6KXRQbk8gPtRPUPF6QDg/7WUXLo1rxuYQCynusNwI0pLfArorLzljNzqa1H2LQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768298543; c=relaxed/simple; bh=De6MxpBWgPTQkuuDj9Xy5kDx07vXNJiETlt8r1WHXb0=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=BqX3q6bC1BH/UWtygdiG4GY09BK7W6ElR1WPF4U1LrD25oIwv0TSUzFlISV5BlYrvzHnJfsjfBC7uxgBMgafz6hwhUjMTKMtdwo8W35K9hEUeeN3ZlNn5bEGzoBV2c6dY1UfTQAzQZ6jYGb4NmoFp0ILGQoqs0sKx787Nz/U/os= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=YMVW3kLP; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="YMVW3kLP" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 89262C116C6; Tue, 13 Jan 2026 10:02:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1768298543; bh=De6MxpBWgPTQkuuDj9Xy5kDx07vXNJiETlt8r1WHXb0=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=YMVW3kLPEv47O9vzsrVlXcfUnFAWw8EGWSnzXOEkv31p64+gVdLvTC9i6QlWhZr4Y 8ACZT+a22ec/R2+d+EgH6ubBjm2AVqAQpDzs8B0PiRm1AgVjC2NRzG1LOt9N8EVKB+ bt1vrJbc0wZgKX9JvcK1GC/f+Y9AucQCaiGd2xjkaecADn/KihAikSm+xB+rIDSprz 4BiMBgseYzzecFQ/dlx/oLTJ65FnoTaE8GG1GEVAFkSFXLeLRqv6/ieg70LFixT/4R +FgVrx95gnXqOFYwXfwni1WvgavoBGWLF+lE0dAHoZZlH2GYdmWaFR6vHqAPkes9dr /t9FGmtx+QPog== From: Thomas Gleixner To: "Ionut Nechita (Sunlight Linux)" , Frederic Weisbecker , Ingo Molnar , Anna-Maria Behnsen , Ionut Nechita Cc: linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/1] tick/nohz: Add fast-path tick stopping for idle isolated cores In-Reply-To: <20260106153646.23280-4-sunlightlinux@gmail.com> References: <20260106153646.23280-2-sunlightlinux@gmail.com> <20260106153646.23280-4-sunlightlinux@gmail.com> Date: Tue, 13 Jan 2026 11:02:19 +0100 Message-ID: <873449g79w.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 On Tue, Jan 06 2026 at 17:36, Ionut Nechita wrote: > From: Ionut Nechita > > When a CPU is configured as nohz_full and is running the idle task with > no tick dependencies, we can skip expensive dependency checks and s/we can/it is possible to/ > immediately allow the tick to stop. This significantly reduces timer > interrupts on properly isolated cores. > > The patch adds: "The patch adds" is a pointless filler phrase. See Documentation/process/ > + /* > + * Prefetch dependency structures for better cache locality > + */ > + prefetch(&tick_dep_mask); > + prefetch(&ts->tick_dep_mask); > + prefetch(¤t->tick_dep_mask); > + prefetch(¤t->signal->tick_dep_mask); These are really not required. > + /* > + * Fast path for idle isolated cores: if this is an isolated CPU > + * running the idle task with no dependencies, we can skip expensive > + * checks and immediately allow tick to stop. This significantly > + * reduces timer interrupts on properly isolated cores. > + */ > + if (tick_nohz_full_cpu(cpu) && > + is_idle_task(current) && > + !atomic_read(&tick_dep_mask) && > + !atomic_read(&ts->tick_dep_mask) && > + !atomic_read(¤t->tick_dep_mask) && > + !atomic_read(¤t->signal->tick_dep_mask)) { > + return true; How is that different from the existing checks for the various dependency masks, except for the added nohz_full_cpu() and is_idle_task() conditions? I can see that not going through the per bit checks is faster, but I really do not see how this reduces the timer interrupts by an order of magnitude. At least not without a proper explanation why this matters and how this optimization is causing this improvement. Also why is this restricted to tick_nohz_full CPUs and to the idle task? You can avoid the per bit evaluation way simpler, which improves the evaluation independent of context. See uncompiled patch below. Thanks, tglx --- --- a/kernel/time/tick-sched.c +++ b/kernel/time/tick-sched.c @@ -344,6 +344,9 @@ static bool check_tick_dependency(atomic { int val = atomic_read(dep); + if (likely(!tracepoint_enabled(tick_stop))) + return !val; + if (val & TICK_DEP_MASK_POSIX_TIMER) { trace_tick_stop(0, TICK_DEP_MASK_POSIX_TIMER); return true;