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 C367BC4167B for ; Wed, 6 Dec 2023 17:51:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1442732AbjLFRvp (ORCPT ); Wed, 6 Dec 2023 12:51:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56590 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378776AbjLFRvo (ORCPT ); Wed, 6 Dec 2023 12:51:44 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BECB9122 for ; Wed, 6 Dec 2023 09:51:50 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D4514C433C8; Wed, 6 Dec 2023 17:51:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1701885110; bh=YMA3TAsSiUul57FlmdTimYbCUDIjWoEz6/pHObLXG7Q=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=iDHqvkcoAXQo1mrhbAIkDpwA0Pez0mmJTk0fEIJi2jFFE6O/CGvrguCIeT8PEIa/6 hzI6RV7iU6NxKEuLQzhac8mPU/xN3wdnoPElZSxiF5jARVzMB7do7e/hVTztB2wsx0 GaW5Va9v5AeLvvrHH6w/yA84FOGsWxXbVRFfeA18OuYkh4e2u7gYRWvKCaOIDY0fbO qT9Dur0ozn6JuwNDUZpOaFB48PvVrA1LTIa1hnTQZ5XpIcnsI+5HdNvNyoREXrkgK8 EHGDgEO6WH1SSzU3Xq7zAhLu9xawZgXsSxXnGWvIwWKN7LO2Kgu9AkwK4wXlgdGbD9 MX4sfAL5N7Tfg== Message-ID: Date: Wed, 6 Dec 2023 10:51:49 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2] neighbour: Don't let neigh_forced_gc() disable preemption for long Content-Language: en-US To: Stephen Hemminger , Judy Hsiao Cc: Eric Dumazet , Simon Horman , Douglas Anderson , Brian Haley , "David S. Miller" , Jakub Kicinski , Joel Granados , Julian Anastasov , Leon Romanovsky , Paolo Abeni , linux-kernel@vger.kernel.org, netdev@vger.kernel.org References: <20231206033913.1290566-1-judyhsiao@chromium.org> <20231206093917.04fd57b5@hermes.local> From: David Ahern In-Reply-To: <20231206093917.04fd57b5@hermes.local> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 12/6/23 10:39 AM, Stephen Hemminger wrote: > On Wed, 6 Dec 2023 03:38:33 +0000 > Judy Hsiao wrote: > >> diff --git a/net/core/neighbour.c b/net/core/neighbour.c >> index df81c1f0a570..552719c3bbc3 100644 >> --- a/net/core/neighbour.c >> +++ b/net/core/neighbour.c >> @@ -253,9 +253,11 @@ static int neigh_forced_gc(struct neigh_table *tbl) >> { >> int max_clean = atomic_read(&tbl->gc_entries) - >> READ_ONCE(tbl->gc_thresh2); >> + u64 tmax = ktime_get_ns() + NSEC_PER_MSEC; >> unsigned long tref = jiffies - 5 * HZ; >> struct neighbour *n, *tmp; >> int shrunk = 0; >> + int loop = 0; >> >> NEIGH_CACHE_STAT_INC(tbl, forced_gc_runs); >> >> @@ -278,11 +280,16 @@ static int neigh_forced_gc(struct neigh_table *tbl) >> shrunk++; >> if (shrunk >= max_clean) >> break; >> + if (++loop == 16) { > > Overall looks good. > Minor comments: > - loop count should probably be unsigned > - the magic constant 16 should be a sysctl tuneable A tunable is needed here; the loop counter is just to keep the overhead of the ktime_get_ns call in check.