From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f51.google.com (mail-wm1-f51.google.com [209.85.128.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 84F0933D6C5 for ; Tue, 6 Jan 2026 15:37:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.51 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767713844; cv=none; b=rN4JtU5h/1z2o3irp9aArdV2AC+BPNBjAT5QAd+nKyPjDEgqKlpZvq0r9foW6XelYxLtd0eBaJz115UPed/jpIUB8gL6/sgvlZ5uI9vrKmdMjQnr7sABJ/h4+VdhuhwJS1aI8d11TmwLnZRzUJwlIFGdUYRUCzoSkQR3C6Mg1rc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767713844; c=relaxed/simple; bh=iXGwgn20gKFFKy1itI3ObbsHziZD01qhJc5wSf30+kc=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=k0LTzHfvxIlcj/5uq42zp/DtW5nBZ+qM8Z2Qfi/vLqvASg2Iwyr8ODtegUSAHouH04WzH7ywd16ThVZMwksuzlc6PfI4FZerQM135ANTSGqtac6gufnaRRParr/68R5UCbFsPpBRs+L6+18q7yD2rGle7zuaEHHME/MSVlAEjVQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=lUD3GcEi; arc=none smtp.client-ip=209.85.128.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="lUD3GcEi" Received: by mail-wm1-f51.google.com with SMTP id 5b1f17b1804b1-4779aa4f928so11693735e9.1 for ; Tue, 06 Jan 2026 07:37:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1767713841; x=1768318641; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=qI/KB3QnGeme8MaEgy59dP7Fx/8kADekRfLzuluXNAc=; b=lUD3GcEiUDaDIkkvr1QoBQhc1wD49bRoPSOEtctUMVOrGjQkyHA0cMXhHRjUhHc8e1 CHQVAEIeaE0d1saFbE1avX6y7zModqU6LpjH4iVQTVI81NWqgBxFX5AleqqKF5PgsROu EsQBnNtkMVWunAs+N4nhzohQsz+UkWxRYE4vlWF3umPWDGhlW1FZxGkQ5f+QLww/NB55 8VpdR3l39xlKjQ5x2NmkrunjDMfrtJRIeFK2VhXjWSje+pRvXv/LCm9bc2LXJoybgfpx caZmauck6/wCkPxCtgGktuuQTVt/xeCZyK6TUNAhmz0nRNE+AptZ+hT1dvxgSmlk/3IF 6FmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767713841; x=1768318641; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=qI/KB3QnGeme8MaEgy59dP7Fx/8kADekRfLzuluXNAc=; b=DNiQc+mlyzo6/Kq5RoJthV/YI6zYoVk2kY8vprDh6Z0d/BuSmhlnhz59APlH14KbJT WROciMlnWrvAWzYuDx5EPO20+eSfxea/8w3/+S2xrGnl9b2wTbwJLjiq0xHAZm+1k6+k X9JsxmR4M41HjReVXFnE0GmGgqMeY7bsMbCyx4RsAdvpp22jbKseLFHw6LTQ9JWw1DRx Za2C7C2wP+ZyAhnptAEUfYw+WpSGLqtVHOB7swSR/zax2HX9AWk7eAK074MojUFnoIEu gJ0/vmH/QJDcEBgTDKvEc2mOvJnFor3iLmVEbJh7BwxEQsmoUO4/3Ipflz3QvmB2/KC7 q6fQ== X-Gm-Message-State: AOJu0Yzp28cP1jA0ur6B0WFBFr/8BGzqXGoyt1vUFsf1oeWdJLWDz3Lc YDO3SuS+eIl7Hn4Mfom4iZWYlqRBm2LRhfESnysgbmqgmArfs0ZsOXHWdoV62g== X-Gm-Gg: AY/fxX5p7PjLcKyqjb9Omnk96M5qCnlNFlgQJ2dSgJPdbbG6MwyLd23NiHdBMK+sYOW 1km9bPuzBM5SCxNvlKQLMVaJiowC4i8gjIVVTIt+IN+iIb6pUjduH3ulBQqV/UgjnljPRZfoQLj 47A55xRejZR7E72FyxK0PibPsi8fQ2n/aVN6a58A1gxqRpmY//27t63RFQGwGZ8enQIavMemsRz ZkT0ORYyH/SVv8UnvAm6paZvT+YHrTlECJQ/nsxp/p4qP+9RBzvoktlPF5r9xiEqUvq4AnfHo/+ HRQLA5xk7ZQeXZhNgIwgreXLSFTShm+2sTKhjovPkJmXn/QtJUifbtVKgcQE81aGoz703oRauFS N6L5eg7+2tCVrU7779JVT6CLuCXWOE+DGsVluenaZ0pB4KruUijtkZ+3BG1hUTl5gG2aXZbv8EN jOB26Z1oTZaYM/E0OAjgeOxuUGY1v5rovEmfOowGQ= X-Google-Smtp-Source: AGHT+IEohVN86ldU0Wj9ltlLa0zneZvDJL7WS6yL0G5S2XLsPPw0VJWWHq9VarUTSuG/cnvPltRqZQ== X-Received: by 2002:a05:600c:4e16:b0:477:7991:5d1e with SMTP id 5b1f17b1804b1-47d7f09da93mr38957515e9.25.1767713840611; Tue, 06 Jan 2026 07:37:20 -0800 (PST) Received: from ionutnechita-arz2022.local ([2a02:2f0e:ca09:7000:33fc:5cce:3767:6b22]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-47d7f653c61sm48097395e9.10.2026.01.06.07.37.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Jan 2026 07:37:20 -0800 (PST) From: "Ionut Nechita (Sunlight Linux)" To: Thomas Gleixner , Frederic Weisbecker , Ingo Molnar , Anna-Maria Behnsen , Ionut Nechita Cc: linux-kernel@vger.kernel.org Subject: [PATCH 0/1] tick/nohz: Optimize tick stopping for isolated cores Date: Tue, 6 Jan 2026 17:36:46 +0200 Message-ID: <20260106153646.23280-2-sunlightlinux@gmail.com> X-Mailer: git-send-email 2.52.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Ionut Nechita This patch optimizes the tick stopping mechanism for nohz_full isolated CPUs by introducing a fast-path that reduces timer interrupt overhead on idle isolated cores. Background: ----------- CPU isolation with nohz_full is critical for latency-sensitive workloads such as real-time applications, high-frequency trading, audio processing, and gaming. The current implementation performs extensive dependency checks even when the CPU is idle with no active dependencies, leading to unnecessary overhead and delayed tick stopping decisions. The Problem: ------------ When an isolated CPU becomes idle, the kernel checks multiple dependency masks (global, per-CPU, task, and signal group) through function calls that include tracing overhead. This checking process, while thorough, introduces measurable latency that can cause: 1. Delayed tick stopping decisions 2. More frequent tick restarts 3. Higher interrupt overhead (LOC - Local timer interrupts) 4. Reduced effectiveness of CPU isolation Implementation: --------------- The patch adds two optimizations to can_stop_full_tick(): 1. Prefetching: The dependency structures are prefetched into CPU cache before they are accessed, reducing memory latency for both the fast and slow paths. 2. Fast-path: For idle isolated CPUs with no dependencies, we perform simple atomic reads of the dependency masks. If all are zero, we immediately return true, skipping: - 4 function calls to check_tick_dependency() - Multiple branch predictions and tracing points - Additional atomic operations within those functions Benchmark Results: ------------------ Testing was performed on systems with nohz_full configured CPUs running idle workloads: Before patch: - Moderately isolated CPUs: ~8000 LOC interrupts - Well-isolated CPUs: ~500-1000 LOC interrupts After patch: - Moderately isolated CPUs: <500 LOC interrupts (94% reduction) - Well-isolated CPUs: 122-125 LOC interrupts (75-88% reduction) The improvement is most significant on CPUs that frequently transition between idle and active states, which is common in real-time workloads. Testing Methodology: -------------------- Tests were conducted by: 1. Booting with nohz_full= isolcpus= 2. Running isolated workloads with periodic idle transitions 3. Monitoring /proc/interrupts LOC counter over 10-minute periods 4. Comparing interrupt counts with and without the patch 5. Testing across multiple CPU architectures and workload patterns Impact: ------- This optimization is transparent to existing code and maintains all safety guarantees. The fast-path only triggers when all dependency checks would pass anyway, so there is no functional change - only improved performance. The patch benefits any system using nohz_full CPU isolation, including: - Real-time systems (PREEMPT_RT) - Low-latency audio/video processing - High-frequency trading applications - Gaming systems with dedicated CPU cores - Scientific computing with isolated calculation cores Future Work: ------------ Additional optimizations could include: - Per-CPU statistics to measure fast-path hit rate - Architecture-specific prefetch optimizations - Extended fast-path for non-idle but single-task scenarios Ionut Nechita (1): tick/nohz: Add fast-path tick stopping for idle isolated cores kernel/time/tick-sched.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) -- 2.52.0