From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 C838F3ACF17 for ; Fri, 7 Aug 2026 07:02:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786086161; cv=none; b=Q9cpqEUkpcnOP3ms8Ic/HPNVUSUiTYGXnF5r4lEJbo/bovDQQuK7vfkCu8RO7g6dsJqqOfSpUPpRUTiFTDargj9t93nLgydyZYdPF+1G1Jt5iR98sY4M2LcpJId2+CKmm+1scKWB6QTN77sD+vK9d4cbmRh6AIW+y0wW3tfATCE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786086161; c=relaxed/simple; bh=ec5Ah/8+IE+sh6duXoIfePrYPk/nTB/nNJ9FI66HfV4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=HKv+aHCGgiRynPxjDhob2GngdEvmaqwjy+CuQDmGyoq1+R7Vw51pDzH+t5B8NbCk4hLLic4IN01OJnDgyozaTvfiosJ5yJ7Fqh0LDCe+aA0DQVUjzKr646Upckr3MjJ03YzS+vogTTKzA81+CoYPra4SDKQB3v0beIPjoPFkEMs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=m11ZftOA; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="m11ZftOA" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3165C1F00ACF; Fri, 7 Aug 2026 07:02:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1786086159; bh=0thUqhS5l/CCHvciQUIdxDtNj6hdUCGVYjpithCalyQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=m11ZftOAn7lpulkzJUtOyQQw0ULphlxM8nXGezNFS7Ukf6hNZs2kFO9Q9IwinnDDW /pgRo0r9ePJp5rMBm9V1T2uAcJfLtFHROYvqdlkVQqWGNOpR0yktxFIPzExaaiGODn AsYUv0EyAQPo8dr/jmzljdK/Up2W8C3hb6gMuX0d8AFiv3rnHj5SLIJBchIRqSw/f3 QfypX+zVqluc27U07YDX6CNzf23fHT2OpFSbpjorddbDnlToCZ8hn3V0rRUT3JoNGg cyw9czjIHVblKe+aob3WboyJLu5QOM4Ee8vYLEvGYmpKQx5xyuOeuGruv19ghc94fs B3GlZ/PRM8LuA== Received: from phl-compute-04.internal (phl-compute-04.internal [10.202.2.44]) by mailfauth.phl.internal (Postfix) with ESMTP id 49A89F40069; Fri, 7 Aug 2026 03:02:38 -0400 (EDT) Received: from phl-frontend-03 ([10.202.2.162]) by phl-compute-04.internal (MEProxy); Fri, 07 Aug 2026 03:02:38 -0400 X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: dmFkZTELT6mPBN+tf+gYDjbmfxF2aJuNia3fHRbo+cksodwgHpv175RY/La8br7LVuLKD+ xpTrulxkYenRUqjuFjoYpWp5kB81fkgSYs4cUOn9Aimg2+sWPDBZPSJD0AkLNVKo9ymnEn XwkNJDHucJ7KY3ALZ5VcWOWe5XHuNtoJV5e7Q54FFSKl7KOd+nrEm1L6dR4Jdu+LjwwV/e gMJ05NqNZsVzzu9M3eDFzAUAJPeoh4s2jJHbhIzGNi7DAZxkNRx1H6hWOvNKjwmDuMbW1g 3/Yvg82sjVAOqgIP9o+xyvh3ddqbO1HSSPQ13n3n5YTt3W/2pxiARls47VLAs4X6PdSfn7 FjdcdWmyNBOJOpt+tNjN4wi434/K/O/VFxjISq5bGdyaOyy7vv12JndAONN3A+H7z76zu4 eF2Ozq4Tn/Cs1RV4VEGkwDVMevlFYq7W7n9wYWs373dMMWD7n6HKfHglJKDZPLoNcZ63qp 2uA1GH5NSkoE5b/T9rXbH7WpQ/lLTValIdz0VKK0sIIa0FFtqkN21yNMnZ2WXOnb+q+DUc 3Rg38qPk+i0vKaalK55l7fmiZ/uBu1PbWwgIwMFyOqcplC2FmIlLyNe4zWHVKsyMlQ13FZ 1uHocHcpvOhORQ1Cjxv9l/D+s6ZtEZwCGVZovP09fToS8RMQOMZTAExNeK8A X-ME-Proxy: Feedback-ID: i8dbe485b:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 7 Aug 2026 03:02:37 -0400 (EDT) From: Boqun Feng To: Peter Zijlstra Cc: "Ingo Molnar" , "Will Deacon" , "Boqun Feng" , "Waiman Long" , "Gary Guo" , "Alice Ryhl" , "Lyude Paul" , "Daniel Almeida" , =?UTF-8?q?Onur=20=C3=96zkan?= , "Miguel Ojeda" , "Danilo Krummrich" , linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org, Shrikanth Hegde , Madhavan Srinivasan , "Christophe Leroy (CS GROUP)" Subject: [PATCH v5 09/18] sched: Remove the unused preempt_offset parameter of __cant_sleep() Date: Fri, 7 Aug 2026 00:02:06 -0700 Message-ID: <20260807070218.27144-10-boqun@kernel.org> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260807070218.27144-1-boqun@kernel.org> References: <20260807070218.27144-1-boqun@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 The preempt_offset is always 0 in all the callsites of __cant_sleep(), hence remove it. It also allows us to clear up the code a bit by no longer using a "preempt_count() > .." comparison. Signed-off-by: Boqun Feng --- include/linux/kernel.h | 4 ++-- kernel/sched/core.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/linux/kernel.h b/include/linux/kernel.h index e5570a16cbb1..24414c79e59a 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h @@ -72,7 +72,7 @@ extern int dynamic_might_resched(void); #ifdef CONFIG_DEBUG_ATOMIC_SLEEP extern void __might_resched(const char *file, int line, unsigned int offsets); extern void __might_sleep(const char *file, int line); -extern void __cant_sleep(const char *file, int line, int preempt_offset); +extern void __cant_sleep(const char *file, int line); extern void __cant_migrate(const char *file, int line); /** @@ -95,7 +95,7 @@ extern void __cant_migrate(const char *file, int line); * this macro will print a stack trace if it is executed with preemption enabled */ # define cant_sleep() \ - do { __cant_sleep(__FILE__, __LINE__, 0); } while (0) + do { __cant_sleep(__FILE__, __LINE__); } while (0) # define sched_annotate_sleep() (current->task_state_change = 0) /** diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 96226707c2f6..aa116daf21bd 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -9199,7 +9199,7 @@ void __might_resched(const char *file, int line, unsigned int offsets) } EXPORT_SYMBOL(__might_resched); -void __cant_sleep(const char *file, int line, int preempt_offset) +void __cant_sleep(const char *file, int line) { static unsigned long prev_jiffy; @@ -9209,7 +9209,7 @@ void __cant_sleep(const char *file, int line, int preempt_offset) if (!IS_ENABLED(CONFIG_PREEMPT_COUNT)) return; - if (preempt_count() > preempt_offset) + if (preempt_count()) return; if (time_before(jiffies, prev_jiffy + HZ) && prev_jiffy) -- 2.50.1 (Apple Git-155)