Received: by 2002:ac0:e350:0:0:0:0:0 with SMTP id g16csp71986imn; Thu, 28 Jul 2022 23:13:11 -0700 (PDT) X-Google-Smtp-Source: AGRyM1utbY5SfgHRp88K7nezcOFi1N6+U8n1Va6gHzW1TqjCy4kC31Ur3w5uxxlFjiAj5QYCM0np X-Received: by 2002:a17:907:28d6:b0:72b:7497:76b with SMTP id en22-20020a17090728d600b0072b7497076bmr1721113ejc.365.1659075191358; Thu, 28 Jul 2022 23:13:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659075191; cv=none; d=google.com; s=arc-20160816; b=hvGQlryodqGxXBf1BpjqGfXnRwzjpz5a2h3Uhu2RM9nqKe/P15SV1PrD0TPr6gN3li tODlFwCrXZAgcSeAWqT/RisZOgnGXfpaoJXb/c/V/J5hwjVVr82j/wP6ex6ZZENUu+K/ /DstlFduHgXf3dkr97S6urF2cjfu+tls9XQOVjIrMYSv8aDxzb3jYiIkC4fiKLFZs4d6 956xMqbLgQD+vTpKB6oFYS2jOW7vlrL8m/U6LO7erB/UrvozqOCWpF15yRyARPkXUDza QWzbboabHQdCk1wBY9xNXIKdkP7ZYaoo2l3J9lt568iRDnBfz5my5YvKa5T0Tz8AAEj5 Q+fg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-language:content-transfer-encoding :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=icROPc/MjTM292/hlbxjXsrb2/CwgLUag0sRKhpgtgE=; b=hwh/P7AvsdcBO44VaiIa1Njy39ZvGzoe6WHtSUr07dVD09H8xQuglpi+qWMTFkjVZd kizQZI0gWiXjumRY5gkJ73a8Pr5qqm4lBCV906n6TCRfq3yu25UzzEMuqmyrlzvXyYNn I15tRTH6jCZ2pbvGhNzANlDA0eAy4D1LAAlpKHR4/v8n+XRzERmrffg/cW6A+3IJCAyQ JJMaMSMs4cccTTAQU75NwYWgckCPllW/IAR3SILuJ9nZsvBhTKDI1vKQuUo4+NeojHK2 xHr3lDbdkJ+6xxeskGjxr3/jmZtVkNT9tI6DlvSF6uJddBdsZ2t9QfTimqnrtgOUYtOU 142w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id lr2-20020a170906fb8200b0072b3b4f016bsi2499318ejb.628.2022.07.28.23.12.46; Thu, 28 Jul 2022 23:13:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234074AbiG2FtR (ORCPT + 99 others); Fri, 29 Jul 2022 01:49:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43188 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229445AbiG2FtQ (ORCPT ); Fri, 29 Jul 2022 01:49:16 -0400 Received: from mail.nfschina.com (unknown [IPv6:2400:dd01:100f:2:72e2:84ff:fe10:5f45]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 390C620BEA; Thu, 28 Jul 2022 22:49:14 -0700 (PDT) Received: from localhost (unknown [127.0.0.1]) by mail.nfschina.com (Postfix) with ESMTP id E42631E80D77; Fri, 29 Jul 2022 13:49:06 +0800 (CST) X-Virus-Scanned: amavisd-new at test.com Received: from mail.nfschina.com ([127.0.0.1]) by localhost (mail.nfschina.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id TcvvCQeC8H69; Fri, 29 Jul 2022 13:49:04 +0800 (CST) Received: from [172.30.18.178] (unknown [180.167.10.98]) (Authenticated sender: yuzhe@nfschina.com) by mail.nfschina.com (Postfix) with ESMTPA id A59E21E80CF9; Fri, 29 Jul 2022 13:49:03 +0800 (CST) Subject: Re: [PATCH] dn_route: use time_is_before_jiffies(a) to replace "jiffies - a > 0" To: Paolo Abeni , davem@davemloft.net, kuba@kernel.org Cc: linux-decnet-user@lists.sourceforge.net, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, liqiong@nfschina.com References: <20220727024600.18413-1-yuzhe@nfschina.com> From: Yu Zhe Message-ID: <98b5da7e-74d2-0350-e0fc-a98ca3cb944c@nfschina.com> Date: Fri, 29 Jul 2022 13:49:09 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,NICE_REPLY_A, RDNS_NONE,SPF_HELO_NONE,SPF_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 在 2022年07月28日 21:11, Paolo Abeni 写道: > On Wed, 2022-07-27 at 10:46 +0800, Yu Zhe wrote: >> time_is_before_jiffies deals with timer wrapping correctly. >> >> Signed-off-by: Yu Zhe >> --- >> net/decnet/dn_route.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/net/decnet/dn_route.c b/net/decnet/dn_route.c >> index 552a53f1d5d0..0a4bed0bc2e3 100644 >> --- a/net/decnet/dn_route.c >> +++ b/net/decnet/dn_route.c >> @@ -201,7 +201,7 @@ static void dn_dst_check_expire(struct timer_list *unused) >> } >> spin_unlock(&dn_rt_hash_table[i].lock); >> >> - if ((jiffies - now) > 0) >> + if (time_is_before_jiffies(now)) > Uhmm... it looks like the wrap-around condition can happen only in > theory: 'now' is initialized just before entering this loop, and we > will break as soon as jiffies increment. The wrap-around could happen > only if a single iteration of the loop takes more than LONG_MAX > jiffies. > > If that happens, we have a completely different kind of much more > serious problem, I think ;) > > So this change is mostly for core readability's sake. I personally find > more readable: > > if (jiffies != now) I agree and I will send a v2 patch later. > > Cheers, > > Paolo > > p.s. given the above I guess this is for the net-next tree, right? > yes >