Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1892414rwd; Fri, 9 Jun 2023 03:54:38 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6MAIlESpc0bELlIgMA3f0UWetUVxa2+NcEnD3d5vIKAZVB09OOwwGoxfbnSxU2iO/ZMCu8 X-Received: by 2002:a05:6359:a01:b0:129:10d8:e34b with SMTP id el1-20020a0563590a0100b0012910d8e34bmr1031044rwb.11.1686308078462; Fri, 09 Jun 2023 03:54:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686308078; cv=none; d=google.com; s=arc-20160816; b=j5FRfL81/XNEPVuh9581lRY5+vI+X97F75F+qSd5od2MelpmfGIeJlKfhRgMLdnMy+ VTdqB9SQSDWGP3LTQk39c/L/JQDso4HDA3CJzaC94Tw0yAQyextoTHyBt5Js5v1pzNmF mqBDW2D9TM6LzmMN9wYumtubYEWqDfXMbTNpXYGbiUUXvHOnOdlAPJGL1xHWXHN+n7pI AUf92LtK0ipj5YmEHoSD0B1dUjWLzCyrg19HMS2P9fU6Pq5YaZ8p/1XiF3OYOzFfILzW uLSYxfJQzAJNlSDM7ha6JXjNnWPaG/JFBOxtusJm8pjy6lja5igcceI5VMZ3VAr0rI2n aNDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:date:from:dkim-signature; bh=ZsXlyZxQYx0ra+Pn6hnVbja5cmTXlxt076zWMBWb7Bg=; b=OMVnXrYwBfVRm3PLNEriS/f/Hr4dMkwmIN5mWagvBae8t79Vltjqg7Wp1cZ09QKbi3 /6SAxYoK9c/VderapeXEqwuK+JlH/RwJwld08ABYdSu9fQX6145O6bepYnFCrXlloERM RvF3X4xL0zAepl1YolXDLIlrH2VtbxJVp+ov5yQ0xhy6w7McL4nCZWwioIk0+UuzvyMv zHhUGIf1vgTX1RMSjw8bfz4Ai+hIq0+Luq2FgNf7k7urfCTGqB9L8+c96hG3cXuDSk/u j5EZyS3/IDU8hIacLHdbHqTQnlvC63HbzeRpocP+x5IXk9SKLs1gy8Vr3f2eR9rGbU78 X7YA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=G8k8tP1d; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o24-20020a639218000000b0054290a76b1csi2439136pgd.112.2023.06.09.03.54.23; Fri, 09 Jun 2023 03:54:38 -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; dkim=pass header.i=@gmail.com header.s=20221208 header.b=G8k8tP1d; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230199AbjFIKQ1 (ORCPT + 99 others); Fri, 9 Jun 2023 06:16:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54800 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242004AbjFIKPS (ORCPT ); Fri, 9 Jun 2023 06:15:18 -0400 Received: from mail-lj1-x233.google.com (mail-lj1-x233.google.com [IPv6:2a00:1450:4864:20::233]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 43A4D49F9 for ; Fri, 9 Jun 2023 03:07:16 -0700 (PDT) Received: by mail-lj1-x233.google.com with SMTP id 38308e7fff4ca-2b203360d93so17320221fa.3 for ; Fri, 09 Jun 2023 03:07:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1686305234; x=1688897234; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:date:from:from:to:cc:subject:date:message-id:reply-to; bh=ZsXlyZxQYx0ra+Pn6hnVbja5cmTXlxt076zWMBWb7Bg=; b=G8k8tP1defmJv6D0Ppt6lXhRm2WLO5Y6XIYQjgDlD9s8jq4XOOd9+W4DDvzAqXzJMH sR86W0eERAjU+F1zYFVVyHJPTuvnvGJcXFgHMmC+IC9XoHOcLf8uiBYM4c1oy6GDLGBA 5G6WLctxMP2gQja2xn0gr7og+/QMemap3kmcrEcOPR0Xdle4TCtP+WLUNbfyAIVMbjxJ xSgfNsCxedAw5vrNbYlcmWoGafcrit//kqQnYnbJomqL+C8zSrvpgDg8W/lHRIzKpVHy VD2TfznkgEeddSxfult2qtxd7A1EZGv8cgYfmdoNDRCpFR3RxwCAIaw4/h9oI/fOus0o vX+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686305234; x=1688897234; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:date:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=ZsXlyZxQYx0ra+Pn6hnVbja5cmTXlxt076zWMBWb7Bg=; b=CV35uMxGtLTt0EADFAwYv/26z1ESR1ZCmwgd8eKIt5E0Wub/x7enucMS72TZkBC4TV yfUMJ+Q/17pSw5mj4w9m25lvaNiM/mjS62gHUHgSgXUUyLQiU1RxebXwcbPTVmidU6zs 7vzWBQHMk6jVjvD3p3GhHwrx1uAAho0QzdYpHELgqfQy3pMwpz8bzUhDHuL/OTzOhqxa BZFvNzLkDwHarHVZ/AK/oxjgND5U9IUu2/n02xzOKy+toDRo+5yoNDhYHc6nx/FdvOcI XP0Fm/3rZqvK0PHZWDqbmiDGCebaS1rOi7NTdvFWcU+MWAJaQUtkM+gRaq0QG7ZIcLTz TzoA== X-Gm-Message-State: AC+VfDwtfYmTK5axhxqEp8BVsztGbvBMEAJW2rQ1YLQWqcSJWARCrHYL HWhGbncKod4fcJoFqkXSgEY= X-Received: by 2002:a2e:3314:0:b0:2af:2231:94ba with SMTP id d20-20020a2e3314000000b002af223194bamr856221ljc.3.1686305234077; Fri, 09 Jun 2023 03:07:14 -0700 (PDT) Received: from pc636 (host-90-233-211-151.mobileonline.telia.com. [90.233.211.151]) by smtp.gmail.com with ESMTPSA id z4-20020a2e9b84000000b002a929484fa0sm320230lji.68.2023.06.09.03.07.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Jun 2023 03:07:13 -0700 (PDT) From: Uladzislau Rezki X-Google-Original-From: Uladzislau Rezki Date: Fri, 9 Jun 2023 12:07:09 +0200 To: Lu Hongfei Cc: Andrew Morton , Uladzislau Rezki , Christoph Hellwig , Lorenzo Stoakes , "open list:VMALLOC" , open list , opensource.kernel@vivo.com Subject: Re: [PATCH v2] mm/vmalloc: Replace the ternary conditional operator with min() Message-ID: References: <20230609092602.26412-1-luhongfei@vivo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230609092602.26412-1-luhongfei@vivo.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 > It would be better to replace the traditional ternary conditional > operator with min() in zero_iter > > Signed-off-by: Lu Hongfei > Reviewed-by: Lorenzo Stoakes > --- > mm/vmalloc.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/mm/vmalloc.c b/mm/vmalloc.c > index 29077d61ff81..6125ed506895 > --- a/mm/vmalloc.c > +++ b/mm/vmalloc.c > @@ -3571,7 +3571,7 @@ static size_t zero_iter(struct iov_iter *iter, size_t count) > while (remains > 0) { > size_t num, copied; > > - num = remains < PAGE_SIZE ? remains : PAGE_SIZE; > + num = min_t(size_t, remains, PAGE_SIZE); > copied = copy_page_to_iter_nofault(ZERO_PAGE(0), 0, num, iter); > remains -= copied; > > -- > 2.39.0 > I saw a complain from the robot. Indeed the min_t() variant is better: Reviewed-by: Uladzislau Rezki (Sony)