From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5657DCCA497 for ; Tue, 7 Jun 2022 18:27:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350248AbiFGS1q (ORCPT ); Tue, 7 Jun 2022 14:27:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43378 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352114AbiFGSZd (ORCPT ); Tue, 7 Jun 2022 14:25:33 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 80DA0ED8FD; Tue, 7 Jun 2022 10:54:43 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id EAD74B82372; Tue, 7 Jun 2022 17:54:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3F087C34119; Tue, 7 Jun 2022 17:54:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1654624480; bh=aitm0DDS0jj0cpMndljk1lZmzQ3kflQqheX4kr0zhTM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PA7Y/G+PDxnB5sCNoC1wucF7uGT+HbLhDjb86JFodyk7RihgjqcPwgPvLfD1QREdY hnFn7X06b56Xia91kCfm/rLj3J54J80SHohm3wA9+qgZJV5QT6tpsIatQGaj1jxJIq ckmZ62+R9cggCWt1LEU0cmHxJEU88lFnr8wrGn8DrpENAtY/jMEEvUvwYsRKzmAY40 ExOxJgPJXT5EqFKs1HyjQx3S7NPnHT1w83jYGnOusxuvbX2+l+l/J84Pez2EioHJAs B1pB7jH585SGUsfhzVsJltNb+aKVbtJSfgjdui1l95EEQSWriSv+NCBOGl7/nHBAOS 6cu9JLOUbx17Q== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Daniel Borkmann , Yuwei Wang , Nikolay Aleksandrov , Jakub Kicinski , Sasha Levin , davem@davemloft.net, edumazet@google.com, pabeni@redhat.com, dsahern@kernel.org, yajun.deng@linux.dev, roopa@nvidia.com, netdev@vger.kernel.org Subject: [PATCH AUTOSEL 5.17 40/60] net, neigh: Set lower cap for neigh_managed_work rearming Date: Tue, 7 Jun 2022 13:52:37 -0400 Message-Id: <20220607175259.478835-40-sashal@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220607175259.478835-1-sashal@kernel.org> References: <20220607175259.478835-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Daniel Borkmann [ Upstream commit ed6cd6a17896561b9f51ab4c0d9bbb29e762b597 ] Yuwei reported that plain reuse of DELAY_PROBE_TIME to rearm work queue in neigh_managed_work is problematic if user explicitly configures the DELAY_PROBE_TIME to 0 for a neighbor table. Such misconfig can then hog CPU to 100% processing the system work queue. Instead, set lower interval bound to HZ which is totally sufficient. Yuwei is additionally looking into making the interval separately configurable from DELAY_PROBE_TIME. Reported-by: Yuwei Wang Signed-off-by: Daniel Borkmann Link: https://lore.kernel.org/netdev/797c3c53-ce1b-9f60-e253-cda615788f4a@iogearbox.net Reviewed-by: Nikolay Aleksandrov Link: https://lore.kernel.org/r/3b8c5aa906c52c3a8c995d1b2e8ccf650ea7c716.1653432794.git.daniel@iogearbox.net Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- net/core/neighbour.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/core/neighbour.c b/net/core/neighbour.c index ec0bf737b076..a252f4090d75 100644 --- a/net/core/neighbour.c +++ b/net/core/neighbour.c @@ -1579,7 +1579,7 @@ static void neigh_managed_work(struct work_struct *work) list_for_each_entry(neigh, &tbl->managed_list, managed_list) neigh_event_send_probe(neigh, NULL, false); queue_delayed_work(system_power_efficient_wq, &tbl->managed_work, - NEIGH_VAR(&tbl->parms, DELAY_PROBE_TIME)); + max(NEIGH_VAR(&tbl->parms, DELAY_PROBE_TIME), HZ)); write_unlock_bh(&tbl->lock); } -- 2.35.1