Received: by 2002:ac0:e34a:0:0:0:0:0 with SMTP id g10csp640625imn; Thu, 28 Jul 2022 11:14:46 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sa4+aNpAxWeq64I7/GYaqiNj+WqLBEPtmdvqkmx7kjRyBWhAmxiiuzP5lya/x+K0mF/KQ5 X-Received: by 2002:a17:907:a06f:b0:72b:564c:465b with SMTP id ia15-20020a170907a06f00b0072b564c465bmr137929ejc.344.1659032085947; Thu, 28 Jul 2022 11:14:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659032085; cv=none; d=google.com; s=arc-20160816; b=Dz0MGypzu0/11CubJe0pe5uXVvb6zu0+VVIhwQ/msXpT4ci2lBrYlSC7Lm5oXqlzcw GqY2uN6jE2do6wZaS+akeiFljLSMravz8LSscxe6lVTK51tO1yeuIXxD4CjS58d22jbl XFN4KoVF2H4X6SHg5zPEl8GrJP/4Q7SnvWJrFtLi0tW5Hhv569qIBGSGk2TUjK5NAdtm Vgy3T+AjpzHAjQ/wEUtFIaekEvIvlwzipTE5kx2SkNOCSpOcNaWXBKzSmJzNTXT+WM7E T0n5G9JDWtBVqJMKyInSqRTRj2Logae9x8k5W0fyzd7AfwtgcQxi2HsSV5mS2wrBD39G lL4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=euGCprHtfgeGD2lqEFLlu8boLeebQ0OwrWscZfMj3tw=; b=z6rNAaGbzFp42UWzQIC3gCsFr6f7JNOgjVl+UosBPko296LbYNMR/lmJSc9SODfhlc OUQxukvix+PmpEM6Sp06YW3Xn3DE2f9RuLpKHWi8qbxPNOFePCWjCM0zwdPinXWK4N84 ZrcOtfE2cmcoUvi5sqWMaaGbZ1AvLEfohxBlAy4EDoNVVaKzWoGuIXSJ5j6i+KsqZesR 4TKqIlXAL6vFBrYm+aZsJlLGlcB90Jlve2eGrfIvJ+WTnztX7nio2Tj68+IyhLOpzVuq hCKv6vTEoh5XQ0GMek5UivHDejTQYZlF/fzLEO1pFMy7KCemCIrBdD+vITIrAUnQbIQP n4bw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=CGEsgy3v; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ba12-20020a0564021acc00b0043cdf660c18si1126621edb.323.2022.07.28.11.14.21; Thu, 28 Jul 2022 11:14:45 -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=@google.com header.s=20210112 header.b=CGEsgy3v; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232316AbiG1Roj (ORCPT + 99 others); Thu, 28 Jul 2022 13:44:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50656 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229883AbiG1Rod (ORCPT ); Thu, 28 Jul 2022 13:44:33 -0400 Received: from mail-io1-xd32.google.com (mail-io1-xd32.google.com [IPv6:2607:f8b0:4864:20::d32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AC29C747BA for ; Thu, 28 Jul 2022 10:44:32 -0700 (PDT) Received: by mail-io1-xd32.google.com with SMTP id c185so1910515iof.7 for ; Thu, 28 Jul 2022 10:44:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc; bh=euGCprHtfgeGD2lqEFLlu8boLeebQ0OwrWscZfMj3tw=; b=CGEsgy3vKfpdFOml8CXiObDyA3GwpotxCUspR08fALLfecVo+Kik7YFCYg6JG7GXhi PsDdbkkkBotpd3/JtocEn7l5WP3tMF6M0c0N6E8tDg6qqmYbme/B5GNAKUnQRgFRaESp jnVi6uUVr7qum/bGpT0hh3IPubgeTh2wsMLH9gM1W1Q+7dvqwDZ+4DnhLphHfiMxdWZR DL35hqWIl4KB91cqIpc6l44yBuradKIApi5uQnjY9cTMx9/NW4TBxT774xdoMsRzUNdX Ezgx3N2l71mHpsgC30sjhjoYfYGcNB0nu5RJvI2DD97/rDrBOuQ4lVzz6VRV61W8PC4K jX7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc; bh=euGCprHtfgeGD2lqEFLlu8boLeebQ0OwrWscZfMj3tw=; b=G7zSvl+P3nkv6ojiUBWuSMu3wMZwWbfgyUML9X3gzHwVMAryGEoY/c16sgw30ZcwW1 XKZ/50B6A3c+hF/CG0JwbDegmPaRyxkfy/m1eDo/I72rrzbxnjVZp8euP6V6UpEmdM7y eJ0tGgpe9NVmPGZ3VQ1/EjV57Oeeag5Mg9BEzpDz2xoVyWtYdozs/Bz+4Z8RD9zF4eMt nC2itctJiz4GrzsVyP94Jycgd+JCJcqJMiGBavQFp5qKnQPXFL0hkdBJAK9DeGKL6Uwd SmzFGsjIM7JeZ+SekoeAlUsCJF0uw7XrTD8POGyWud8Rl+6zvxdLQ8FFTgMjSdlOg6RL 0h8w== X-Gm-Message-State: AJIora+IamMErJ/YBy2wGivbzY5EeWaxA/lDqZB6JpIVWQLi3dyvaNab cVKfMq7Y8AcEw+QveTKgPiK5HwvVVbEm8Zlyn7Y++g== X-Received: by 2002:a05:6602:29c8:b0:678:7c44:c2fd with SMTP id z8-20020a05660229c800b006787c44c2fdmr9514661ioq.89.1659030271947; Thu, 28 Jul 2022 10:44:31 -0700 (PDT) MIME-Version: 1.0 References: <20220728121949.20985-1-linmiaohe@huawei.com> <20220728121949.20985-2-linmiaohe@huawei.com> In-Reply-To: <20220728121949.20985-2-linmiaohe@huawei.com> From: Mina Almasry Date: Thu, 28 Jul 2022 10:44:20 -0700 Message-ID: Subject: Re: [PATCH 1/6] hugetlb_cgroup: remove unneeded nr_pages > 0 check To: Miaohe Lin Cc: akpm@linux-foundation.org, mike.kravetz@oracle.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL 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 On Thu, Jul 28, 2022 at 5:20 AM Miaohe Lin wrote: > > When code reaches here, nr_pages must be > 0. Remove unneeded nr_pages > 0 > check to simplify the code. > > Signed-off-by: Miaohe Lin Thanks Miaohe, Reviewed-by: Mina Almasry > --- > mm/hugetlb_cgroup.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/mm/hugetlb_cgroup.c b/mm/hugetlb_cgroup.c > index c86691c431fd..d16eb00c947d 100644 > --- a/mm/hugetlb_cgroup.c > +++ b/mm/hugetlb_cgroup.c > @@ -442,7 +442,7 @@ void hugetlb_cgroup_uncharge_file_region(struct resv_map *resv, > if (hugetlb_cgroup_disabled() || !resv || !rg || !nr_pages) > return; > > - if (rg->reservation_counter && resv->pages_per_hpage && nr_pages > 0 && > + if (rg->reservation_counter && resv->pages_per_hpage && > !resv->reservation_counter) { > page_counter_uncharge(rg->reservation_counter, > nr_pages * resv->pages_per_hpage); > -- > 2.23.0 >