Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp1149682rdb; Wed, 6 Dec 2023 09:52:01 -0800 (PST) X-Google-Smtp-Source: AGHT+IE1SjECbJKJy7+/d2M7KmPe8ducvLqQSmZtovAv55E6RKEEtZ+6OPJz3m7314gKKhRi8ZL+ X-Received: by 2002:a17:90a:4dce:b0:286:6cc1:3f1c with SMTP id r14-20020a17090a4dce00b002866cc13f1cmr1348982pjl.83.1701885120765; Wed, 06 Dec 2023 09:52:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701885120; cv=none; d=google.com; s=arc-20160816; b=WfImygKRKOhpYhbA58246UdHBBK5gXP144YxuvtXWjlysNdhMCI+aTNttYvlIUmk2d /Nj2lY4fZ0Ntk0N1DmWENMrOCYYZaHsyZTB7O8kI8/kkxs7Tae0lxB1rXK5DTwaOac8z FUcqnr9PtF7rgf6RDfCk8be9uiWvJg/akPLAq6F+ojE4lXccWf/IgrJVinn9JzlDLyVJ hN6SZJePWvv5D9aGe0CtWelDKMQlg2AZ4AA5cRvD3sZErHnCAP/mYsUIus12mqMhj2l8 fGc2+xSomxa0vxaEP1zGbKggqTeIDfIbX2pdYRCzkkN0+ZqrjHE9yvQMw1nzT4+8mH9p bYqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=Q0CYk1eZNW/neGg//FfkKVD4Jz4Rg32lHLKBojMTTeM=; fh=VgV7DS6Md9l5rMDcypAoO0gkzv343mZr7P7MoLH06tw=; b=ZJtm7GC6b5PCe19+B4HCG0w43gwC9PL2agTwDt0I9ppqUveoAorXiiY196Po4ThLNE 6QxKSA3iz4pg/NFgMksXx2na+KiddjWoEornL3OWUYs+0FTcanZHXVmBUvnWahwdPiL+ /fK/fvDXNyddfODhUgZfsGLWewCqHcpOxr6MkKDiV8xzh0AhxzfXn7UNCSPLx/VHLkK1 9TB/cfMDd3oW/ipjPW1iPagUikD4jrM0T8lt7e/h+Ph09tY8eTr5IV4+tG2OwMuBjP5R ShQcX6NnwiwB7lVWf3n9IDJneZtSkNqW7yeK3dBrE3dRECMcW73Ty+FHguAoEF0+j8IE IT6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=iDHqvkco; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id t23-20020a17090ad15700b0028658c54f6bsi197063pjw.11.2023.12.06.09.52.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 09:52:00 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=iDHqvkco; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 152A38087232; Wed, 6 Dec 2023 09:51:58 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1442716AbjLFRvo (ORCPT + 99 others); Wed, 6 Dec 2023 12:51:44 -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 X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Wed, 06 Dec 2023 09:51:58 -0800 (PST) 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.