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 B5CFB188907; Mon, 2 Jun 2025 15:08: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=1748876903; cv=none; b=KhQsLD6ps1CBK1qNoyW9JZ/jxYR/AkVLylo0PO4Apix+9oiofpYzuhVSjyCc0tiHuwdhWTea3y1Ta6UqQevDzRblF7lzhgScRVL1cZj720kPYU55eOLASYHmgLZd6Sugps3hTNqcpO+zu9te8oQx0HFkI4D0zWz9B75eduw6kqY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748876903; c=relaxed/simple; bh=BhhQZRAzkvZ885Zb4zPsFJMKlZvoh21y0FC5rq9c+FM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=MBCFZpOP7p5Q61K7PJWugAm7gk5xJcxrLCnaeN1DU2rFnB//z0hpOueRlSoX1uw4YKkU1gcHg4vuurs3pdeIYElyWTAbs1AtBgGRGet5HjQ33FvXaYZo64CLMWd24d8u1r0TAN8O2FBIAsihPxj8FiVcwSK7Wu4cuRlaGCaMxqI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=j4e8E3pk; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="j4e8E3pk" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E78DCC4CEEB; Mon, 2 Jun 2025 15:08:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1748876903; bh=BhhQZRAzkvZ885Zb4zPsFJMKlZvoh21y0FC5rq9c+FM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=j4e8E3pkfSGF+otGjksJAw6hpcei7r8xXSoOJGUEYLARwrTQ6FmC5MwFgx8A7y72n oi51Uyu40qzuTILMUvdDwr79H6+pYqxeKWUiILjlPgSaPsrZJ10ioYo4AdJYRfwzA2 t+8ykxlUcMBqZro86hbqRSXq/1X+GxWe/W6qi5aM= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Eric Dumazet , Thomas Gleixner , Frederic Weisbecker , Sasha Levin Subject: [PATCH 6.1 080/325] posix-timers: Add cond_resched() to posix_timer_add() search loop Date: Mon, 2 Jun 2025 15:45:56 +0200 Message-ID: <20250602134323.027332977@linuxfoundation.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250602134319.723650984@linuxfoundation.org> References: <20250602134319.723650984@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Eric Dumazet [ Upstream commit 5f2909c6cd13564a07ae692a95457f52295c4f22 ] With a large number of POSIX timers the search for a valid ID might cause a soft lockup on PREEMPT_NONE/VOLUNTARY kernels. Add cond_resched() to the loop to prevent that. [ tglx: Split out from Eric's series ] Signed-off-by: Eric Dumazet Signed-off-by: Thomas Gleixner Reviewed-by: Frederic Weisbecker Link: https://lore.kernel.org/all/20250214135911.2037402-2-edumazet@google.com Link: https://lore.kernel.org/all/20250308155623.635612865@linutronix.de Signed-off-by: Sasha Levin --- kernel/time/posix-timers.c | 1 + 1 file changed, 1 insertion(+) diff --git a/kernel/time/posix-timers.c b/kernel/time/posix-timers.c index 2d6cf93ca370a..fc08d4ccdeeb9 100644 --- a/kernel/time/posix-timers.c +++ b/kernel/time/posix-timers.c @@ -161,6 +161,7 @@ static int posix_timer_add(struct k_itimer *timer) return id; } spin_unlock(&hash_lock); + cond_resched(); } /* POSIX return code when no timer ID could be allocated */ return -EAGAIN; -- 2.39.5