Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp310218rwd; Thu, 1 Jun 2023 00:01:59 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6YE78sLP1xpilvaVPKuh8osZ5pNyR9XlA2qcBXDjQgDbFfr2EOWO8v6P82npCbS73T8GWs X-Received: by 2002:a05:6a00:148d:b0:63d:3c39:ecc2 with SMTP id v13-20020a056a00148d00b0063d3c39ecc2mr1165733pfu.12.1685602919390; Thu, 01 Jun 2023 00:01:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685602919; cv=none; d=google.com; s=arc-20160816; b=uEfk6bV0Sb5taMHma3Qfb3ARJ0ZI/pgNqo9r1z2qSfAF1r3CQd0nNGXW032J+ZVht4 38DwqnlEwPWJBoMB/c7YGeat5GJ6rz/Tjy025LncCSVvyrS2sKng4Mmhqa849gEIdNy9 P27ef/y91v6VMXJmDqgXEX+63JJ7LO9uwyJB8kTMkg7UkHvNXoYOOysnNtB0KjaxXRn7 CBW4L99cs7KY4zHMS+fKVr/vYT5U0furp91SJkPCNhgwvrDwS5KR4GSXjRQgfwSI/gli 7IWCF7HDu4ZogxqGIWItMJVybvjKpMq5u7dV/xtYkbQRq9mUjODlmTZr1YsCXJ1yQlnI XCTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=n2GsxwgwUEfdpBblJK65XRtMqtTO1KwkNNcF5ULWqv0=; b=pdHgloM5GkUsb9tGHaxhRZb/UNvnyklf6X84Vy8xpS7toXYNfRdfbiN55ya/oEK7ZC N9cgYph7YGkes7ZpwVk8oC4uiTkxzWYeg9clfzpMrLvjAnxGjrXKmYOZjXTa8hOfAaR0 8Jz+B/oMhhOkq06r7aTe/4g51wy/T15jAvDoIfL4uLdmMnG4AstwYeEyXRWSUmxIvDMs TPUqGDBoiin3Xu/p+KA8KcQXJE2QJ4a/4wTRaeWsPnOC6sml3EarltDl0VFJtK6Ij3vQ 62CxFsb02zm59AwOgSRcKLOAMxEhO2WINDmmRMJCRubFgs6oJuc/OAkw14u1Vr7MQdYl 2y3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@shopee.com header.s=shopee.com header.b=UZr+uxSU; 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=shopee.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a62-20020a639041000000b0053424040bb7si2317045pge.298.2023.06.01.00.01.43; Thu, 01 Jun 2023 00:01:59 -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=@shopee.com header.s=shopee.com header.b=UZr+uxSU; 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=shopee.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231732AbjFAGf7 (ORCPT + 99 others); Thu, 1 Jun 2023 02:35:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49470 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231682AbjFAGf5 (ORCPT ); Thu, 1 Jun 2023 02:35:57 -0400 Received: from mail-pf1-x436.google.com (mail-pf1-x436.google.com [IPv6:2607:f8b0:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C2C5F98 for ; Wed, 31 May 2023 23:35:56 -0700 (PDT) Received: by mail-pf1-x436.google.com with SMTP id d2e1a72fcca58-64d24136685so435423b3a.1 for ; Wed, 31 May 2023 23:35:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=shopee.com; s=shopee.com; t=1685601356; x=1688193356; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=n2GsxwgwUEfdpBblJK65XRtMqtTO1KwkNNcF5ULWqv0=; b=UZr+uxSUntQeNPbeNZbmzl34Y+FnDg4DPXipdcXF4PcD90hfjjNzJ/6V7Vp9cYGipY 2W0ei1M6WvTloAQtU9yu8SZ69B7fxrjAw3+xeVYxd5sd0LRQu+gYfHBB58DcU9o+wgFU vev+QO7dYDXu6xG3q+ZuzcUx77CEPFtWX61CPzfGsF5TUa9W3dm2pH+Qy24MDzeeD9S5 ov/lWxDZPFVczrJ/JclgpmAzY1RDeu666qgYyOH8Fvk7D0t9PkSEab5u8/5vw5fsFCPR M+u49hPUaLofqYGBUgOdRrllA7qwcvw/xWiMN93jUJW0lguhrwdE29GxezX14R1YrAbW m9wQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685601356; x=1688193356; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=n2GsxwgwUEfdpBblJK65XRtMqtTO1KwkNNcF5ULWqv0=; b=gMDJ/zOX/yyaC2QyL/y1onWDj3f1C1wFECO03HCMk407iz02SSzIQN4XgyoC+vvhPc YIujzJ1oiNqS1VLl0M+gjvCnJGw3nhbfcioITja11kPPNtoc2blsMNgsSAvV+N3aKK+P abWbe//G2i4I/pprX49MmNYBHZPnP7DORgSb3NvSVDrN/qsLU/Oa7Gw6McOzwcZYrsM2 ZXXY2YB9ZKk0AOjIBe2WS24RqobFTxtwJ/OfzBccM/RLEVmOpRGv6oGKjxw+m7XzaRml DHuZ/I183sybPwn5EQmclC6tR5Ln1Wa0lPipeGY7CxCmSrlYOd5thEDEDbLIGP8vCRUm susg== X-Gm-Message-State: AC+VfDzXqAJ4zMwie//apQdI2al0QoiGnLXw7ReoWt+taMjLkHwCtAgz mIhQYA6fmcqUGD4LNCqhzEJkxQ== X-Received: by 2002:a05:6a00:1f96:b0:64d:2a87:2596 with SMTP id bg22-20020a056a001f9600b0064d2a872596mr720870pfb.10.1685601356269; Wed, 31 May 2023 23:35:56 -0700 (PDT) Received: from ubuntu-hf2.default.svc.cluster.local ([101.127.248.173]) by smtp.gmail.com with ESMTPSA id x25-20020a62fb19000000b0062e0c39977csm4302233pfm.139.2023.05.31.23.35.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 May 2023 23:35:56 -0700 (PDT) From: Haifeng Xu To: rppt@kernel.org Cc: mhocko@kernel.org, akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Haifeng Xu Subject: [PATCH 2/2] mm/mm_init.c: do not calculate memmap and reserved pages for empty zone Date: Thu, 1 Jun 2023 06:35:36 +0000 Message-Id: <20230601063536.26882-2-haifeng.xu@shopee.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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 For empty zone, it's unnecessary to account for pages used by memmap. Also, the pages reserved in dma zone can be ignored. Signed-off-by: Haifeng Xu --- mm/mm_init.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/mm/mm_init.c b/mm/mm_init.c index 232efac9a929..b82718d596c3 100644 --- a/mm/mm_init.c +++ b/mm/mm_init.c @@ -1543,6 +1543,13 @@ static void __init free_area_init_core(struct pglist_data *pgdat) size = zone->spanned_pages; freesize = zone->present_pages; + if (!size) { + nr_kernel_pages += 0; + nr_all_pages += 0; + zone_init_internals(zone, j, nid, 0); + continue; + } + /* * Adjust freesize so that it accounts for how much memory * is used by this zone for memmap. This affects the watermark @@ -1579,10 +1586,6 @@ static void __init free_area_init_core(struct pglist_data *pgdat) * And all highmem pages will be managed by the buddy system. */ zone_init_internals(zone, j, nid, freesize); - - if (!size) - continue; - setup_usemap(zone); init_currently_empty_zone(zone, zone->zone_start_pfn, size); } -- 2.25.1