Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp1201589rdb; Wed, 6 Dec 2023 11:16:10 -0800 (PST) X-Google-Smtp-Source: AGHT+IGpGDMUtP9ftGh1D9BufwOlwVQ3iUFSXdlfTIk9hdOxaJw0VKxtMCSZb8G2jWX13sA6eU3W X-Received: by 2002:a05:6a00:17a3:b0:6ce:5721:32cb with SMTP id s35-20020a056a0017a300b006ce572132cbmr1327587pfg.59.1701890170047; Wed, 06 Dec 2023 11:16:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701890170; cv=none; d=google.com; s=arc-20160816; b=kV9oRMGVDYwnZZKwFbZFuz6SIdIgUNEprzUOly1r+XrUmDmIytI+dUp6jglzQNWcoh Wjvsi7f8UKZNbVO3e3NFtNhSFNToYc8mSf/HBEQWzlDse04OdBEjfjDo1tTg31e08cKe RbgjsaYwhFBUZ59Yqd5HEaSk7v3veZNNSFcBio9mjaFAgKwQjb6b9EU0h/mrYkACyt3h JU3DiPaekcokdbPSINhA+K7XwgU7sSLq8aucjrMUjredVUXMpcF6rxN/o9YJYn6mBbj8 XU/tWphpBj+BLlS0Kl2ms15Kx1MZ+26S+1FqRXBbwScokpk0dWvY3hPo5hm5ayf4LCRH 5eIQ== 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=TynP6jEOb0au4dsJ0lJjaHQHlP2OMpxxYHfyKslyyyg=; fh=IMjFSJs2GaJU/mAgrJgLBAR/7uJ0A8LOpyTKgkANDNs=; b=oer9R6NwNYQwmfn0On6IM9gq78uVgFcFD1MA0cdHfpz2ng9jC4eXjg/uA7zgqABRYg BNwUNRvou1sGo6CyI5iUsfJJJD7LsStTfAVQ07OKMa3k4vhhB5dl761hbKoDEaBBLHMH 8iej/JEynH0JRcuhoxCFycJR3VDV1r5ugjKGCucfre1bkv1gjP3eTbM8wtGMm9jAt9cK jScmrMBObBQ36svvKrfrQyC+1lDuzPH59kr3UsbFjSfRjx4BjWpvNKA+Dt0OtkuVu7r6 sfPY4P5BeHe58TKtPEMrtltjqS+irHMClU8Afa2yFjtheYg8NkyJ/WVAuV8SXXX7epcA JeMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ZW3mQY6I; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 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 morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id x63-20020a638642000000b005c684e1f2cesi315017pgd.391.2023.12.06.11.16.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 11:16:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ZW3mQY6I; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 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 morse.vger.email (Postfix) with ESMTP id C511A8079AD6; Wed, 6 Dec 2023 11:15:50 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379337AbjLFTPd (ORCPT + 99 others); Wed, 6 Dec 2023 14:15:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58476 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379257AbjLFTPb (ORCPT ); Wed, 6 Dec 2023 14:15:31 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E620B193 for ; Wed, 6 Dec 2023 11:15:37 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0EA29C433C7; Wed, 6 Dec 2023 19:15:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1701890137; bh=SQBCq+vdv0d3tGaClUH0WQbz0FTWgbIDaKT4M0mAh1M=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=ZW3mQY6IaEElt6DdQcPJRLSzIdWZQ+mW/oGAUfWPF2QMPgjxB9CT2p1Lhiajup1XC oDqO70xg+YNQp5jh9A47oedCCkYEThPN9EUufF8iGfoHJHyA2NGwIEjPxW3LJico6Q ZRXIGKfWNAV0wC6LYY8h0u3cJuWmILQn7Z/dQQUelRcWo5mnS6Q1KIFwT2u7JCO7YS 5nWgtdFB4Shah17Pk0zmJYLglrUo1e+SZlKWrXIznjllXhx8Ydf5/Yq7GqDLtYRn0n SEiXpR8E422gZuQUqE+CRWSH3WHlEIlFKNKhZQ8RZYYiiBfWVX22Pr6pfyIeFXJk24 KysCm5H0cGrTw== Message-ID: Date: Wed, 6 Dec 2023 12:15:36 -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: Doug Anderson Cc: Stephen Hemminger , Judy Hsiao , Eric Dumazet , Simon Horman , 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: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 morse.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 (morse.vger.email [0.0.0.0]); Wed, 06 Dec 2023 11:15:50 -0800 (PST) On 12/6/23 11:49 AM, Doug Anderson wrote: > Hi, > > On Wed, Dec 6, 2023 at 9:51 AM David Ahern wrote: >> >> 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. > > From context, I'm going to assume you meant a tunable is _NOT_ needed here. ;-) > > -Doug yes, multitasking fail :-(