Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2573038rwd; Wed, 14 Jun 2023 04:58:21 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ77kum0/0+zmY8goFv1H9bDM+A7HJGZAsb+N+ZKF4jLuVcxQ7PCJQ4SMJTRJcr3HGAF4PJs X-Received: by 2002:a05:651c:113:b0:2ad:999b:3bd7 with SMTP id a19-20020a05651c011300b002ad999b3bd7mr5922039ljb.19.1686743901036; Wed, 14 Jun 2023 04:58:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686743901; cv=none; d=google.com; s=arc-20160816; b=EtC66A10tR0wujx5AO+2KR/ORDkIYJasqYVDr6ocuQQgdurwBmKpcTS6kK1jeL6UPG KPK3EB5bYVnyfHoy8dIMxqwscSuxexSwJ6LmrzyXn0XJaod9f+qLKSRtTq2vMpmeCFwr 30gMqj8xslD0r4naHaAHmAbBlzmBKtyCX1Mr5vCYi9pdEyTRGo0EYE1Z6JixS0r/5GKI idIJ0YnsJWD4IGLdEf7fMc71ptP7oRLYrL4PHOUmkeYOKVDckAJkBx9s0UH0I31+RUIk SOaq9p/3z6qDQ0FXQsdsIlw84g2E+d8Nsbqn9Z78dgkHiQKzDMx++hK+8C8LSE57nfyh GmMQ== 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:from:date:dkim-signature; bh=KAZFTh9uvAJjj62+EADa43wxlIDZ+1fMMO49wkAFkmU=; b=vMt97nfONCiDZzA816sMXE7ddIjjY9m998uNXWrgXhaMdYhq9G8yzRag0qnmJD0sb6 kgu6GcZoFY8wIX5EWDpkmhnw3eWoPDkEfvJNXrC76ho22CICagzu3+AvgjvYAjINRdBH KIJc+mXKW0BKM0effgz/ZJWoaFDxC1dApljIFBkrs1Df3BPX6aWSkNjtSB3WoVJ+uNuP tHBujh/VsGHTbMa2teU22Ay5JOwLWFnFtkFHI4E0E9r6ej54qb2a11T3GuFXvu07jAlG 1DrqrFwpNTXyfKzVfacHlunTtyQhMLpmyPkVdsIDv2C4uk0OLRfE5FYcHI/oBJ8H400G rJmQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=CphnQVIG; 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=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v16-20020aa7d9d0000000b00514bee2eb69si9120947eds.489.2023.06.14.04.57.55; Wed, 14 Jun 2023 04:58:21 -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=@kernel.org header.s=k20201202 header.b=CphnQVIG; 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=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244288AbjFNLrJ (ORCPT + 99 others); Wed, 14 Jun 2023 07:47:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59672 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239824AbjFNLrC (ORCPT ); Wed, 14 Jun 2023 07:47:02 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 60918A2 for ; Wed, 14 Jun 2023 04:47:01 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id DD21F63F8D for ; Wed, 14 Jun 2023 11:47:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2C5BAC433C0; Wed, 14 Jun 2023 11:46:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1686743220; bh=hUgVO/GCrrBC8yyi34t2DrgRbyXURmTA1orcAkAe0pA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=CphnQVIG1x8bMDw09c1e9AWm29ATdgRMUlx3PSedKkyJy0ap3QEs4UV+c07hXSFeO 0jPIssvrXAQehQdPfmilN6fdB4VSupZzo/I7vCFkRPHKQbalUvoYU1dRARwQ3JxviA JZvOdzFkKBLPHa+UuEo7Qw1vPjozqA2b5c8GvnDuHOe4xkOMe0HFEWnk0cFZyFt0lz 8yHHvRvUDWLjYYgOnIdw/lqs4PshJeIOJY3HIJeDUIwW1u8Ry5EzhPHIplJTzlbGdk g0fIh7WdFMSet/FUInjApJGDJGRJU3rlUNwRL9ceqE/Rq5wAplLeHDEKZGwYTsXEXw pGtlvS18y+Nmw== Date: Wed, 14 Jun 2023 14:46:27 +0300 From: Mike Rapoport To: Peng Zhang Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, akpm@linux-foundation.org, wangkefeng.wang@huawei.com, sunnanyong@huawei.com Subject: Re: [PATCH] memblock: use the helper macro for_each_zone Message-ID: <20230614114627.GW52412@kernel.org> References: <20230612125102.1674568-1-zhangpeng362@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230612125102.1674568-1-zhangpeng362@huawei.com> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, 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 On Mon, Jun 12, 2023 at 08:51:02PM +0800, Peng Zhang wrote: > From: ZhangPeng > > Let's use the helper macro for_each_zone to iterate over all memory > zones and reset the node managed pages. After that, we can remove the > unused function reset_node_managed_pages. Are you sure it's safe to use for_each_zone() in all users of reset_all_zones_managed_pages()? > Signed-off-by: ZhangPeng > --- > mm/memblock.c | 14 +++----------- > 1 file changed, 3 insertions(+), 11 deletions(-) > > diff --git a/mm/memblock.c b/mm/memblock.c > index da4264528e1e..af552604c3fb 100644 > --- a/mm/memblock.c > +++ b/mm/memblock.c > @@ -2122,23 +2122,15 @@ static unsigned long __init free_low_memory_core_early(void) > > static int reset_managed_pages_done __initdata; > > -static void __init reset_node_managed_pages(pg_data_t *pgdat) > -{ > - struct zone *z; > - > - for (z = pgdat->node_zones; z < pgdat->node_zones + MAX_NR_ZONES; z++) > - atomic_long_set(&z->managed_pages, 0); > -} > - > void __init reset_all_zones_managed_pages(void) > { > - struct pglist_data *pgdat; > + struct zone *z; > > if (reset_managed_pages_done) > return; > > - for_each_online_pgdat(pgdat) > - reset_node_managed_pages(pgdat); > + for_each_zone(z) > + atomic_long_set(&z->managed_pages, 0); > > reset_managed_pages_done = 1; > } > -- > 2.25.1 > -- Sincerely yours, Mike.