Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp821314rwd; Thu, 15 Jun 2023 02:30:00 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5tV5n+73tBxTagce7mz/naRgocPqmvh/9+5YTuWCv/NZq2n5j0jK5duLWd6kZMQpLBfWpG X-Received: by 2002:aca:f0f:0:b0:39c:7a20:6245 with SMTP id 15-20020aca0f0f000000b0039c7a206245mr12037739oip.43.1686821400258; Thu, 15 Jun 2023 02:30:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686821400; cv=none; d=google.com; s=arc-20160816; b=txa7CjiqsACyevH+HUiu7C8GUv8WLd+WxjzMkzsOUIfxHDg5n1F0cpZSklY8a4f+qg 6xrMbFwNWGe35Q/A0O/C1uJffp1ne1ezsVHil3P6uwhoLjV3xacOFHSAZF+F1LWIcosv q9X0tRhO8Vr5XnefsVmJQPC3NC5A7IpYveIL7iiNNgHr72UAiTQaZBz/BcgDjbEg2GQU 2zZJJXwxOK7h55QWA4RibJzT3kdUPhHgw8f6jCW7IWu71tP46L3IA2a840cAifr9YwBu hr8gv/YnMB8Entw2OKkuBGwGicFTADj3coqy0hpts+gsdem6fC9b4uR0gxgRCqKRprpz El9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id; bh=36T94F3bcCanJq/eOHW03iGdw7hqv1XTHvNgNzBveIY=; b=0uKLo4KukIeyy/yJHo3majI9aNxhpvwC/fZTRl0pCnz184YnV69cv77ZPBJo2uz0jW YhmuKeFG15S97MDugOh2SFF1zw6ldkwS5sU+njLo3csRUGofaxH89P1EvuigNmLHK9P1 ialFp7BLdQFf0VXM3xgn2wJuvDLbLlKFd1nbncTMKlsOaWZnbtqUQGyoDKDWZ/7mrs6Y cltVoRDmshXfCGVyllvlD2IHGtR4rh92LjJl2bdGT4XY8bhXXCfBLWjXXx+dAprybwhP JZggkdbqgaIBlf6K3K74rmbPnv9fr7RR+wBF9lrFEaTY8d64p47c01S7AClcGVt5Ol5M hwCg== 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; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hg19-20020a17090b301300b00247b1a05438si8840324pjb.16.2023.06.15.02.29.47; Thu, 15 Jun 2023 02:30:00 -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; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244269AbjFOJWS (ORCPT + 99 others); Thu, 15 Jun 2023 05:22:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55182 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243895AbjFOJWK (ORCPT ); Thu, 15 Jun 2023 05:22:10 -0400 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 39B68211C for ; Thu, 15 Jun 2023 02:22:05 -0700 (PDT) Received: from kwepemm600020.china.huawei.com (unknown [172.30.72.57]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4QhcB744kVz18MPq; Thu, 15 Jun 2023 17:17:03 +0800 (CST) Received: from [10.174.179.160] (10.174.179.160) by kwepemm600020.china.huawei.com (7.193.23.147) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Thu, 15 Jun 2023 17:22:00 +0800 Message-ID: Date: Thu, 15 Jun 2023 17:22:00 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.9.0 Subject: Re: [PATCH] memblock: use the helper macro for_each_zone To: Mike Rapoport CC: , , , , References: <20230612125102.1674568-1-zhangpeng362@huawei.com> <20230614114627.GW52412@kernel.org> Content-Language: en-US From: "zhangpeng (AS)" In-Reply-To: <20230614114627.GW52412@kernel.org> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.179.160] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To kwepemm600020.china.huawei.com (7.193.23.147) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,NICE_REPLY_A, 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 2023/6/14 19:46, Mike Rapoport wrote: > 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()? > Thanks for your review. Using for_each_zone() is indeed unsafe in some users of reset_all_zones_managed_pages(). Please ignore. Thanks, Peng >> 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 >>