Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp974297rda; Sun, 22 Oct 2023 19:54:04 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH8WRb0B/bVlYNBcwKocv7kaOuIS7qQosqcMp31ib+JTHfjncvua51hpT22dx/4X+WeSbSK X-Received: by 2002:a05:6a20:6a04:b0:161:28e0:9abd with SMTP id p4-20020a056a206a0400b0016128e09abdmr6325704pzk.16.1698029643653; Sun, 22 Oct 2023 19:54:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698029643; cv=none; d=google.com; s=arc-20160816; b=PY//bbdQ7Y5jy7e+WruoqUkqa8wiyqqYl4cPDyEh73a8eXmPEJLOUPQoDlZYPXFSSG CEvgK1C4RS9tYElZ5XL+MvdNEtxAfLo8yPU/Yf1Lft8mptjupyJc5GtBBgEslFnquoof rkDIopiavSBaqgHnm/PEYUEw4lFDppKLyiJ+s973QscYqk98n1Qm837og3xf0sx0s9Rb weR1hwN7Jg9Pv79q5guzOF534N48Qzn7pz8wMd4wD1BukKaElcnQOWmDBhkG5jKc92oU VU5v/boxF1tIFXotG1/Kju6u/7Ra3drR9Q8tOMFqof181qphs+vZG1ZRiOcWnT4o67+/ AomA== 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 :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=FxlrpfT+18WYqvl8iBNwHnQjJ9RP07edFblWvZMOgNU=; fh=9Hc4ZDaOlhdrnN9Q2VUROR+x409CrgZcJsGNsVNCVz4=; b=dVwbtRcx8GvH+XoCcXejrvgrPI3MUQVsszxFxgILEms8akPC5W6ggY0RaChQ8wn7Dv BcDPUi0H2w8WYEB3VZwiyDHGx1Wh9vroOmNRSVLM/okl0gzqAxIzFR2t+X9PPZezevhr g29SL/HC4wO+XAkECndbvyyiXV0gbR1hKKot7hxoMBXKX/2phQ1B6R+B3NEcKnZ4qv5y ympI5rov0kbYtExLUa2wG2PZlQ96y+uWSMadzsqzXnERlYJbZvwYGm6kJAlCJ2oDbanc w2Qkz3JcGY9L3DyMm4Wz5LUst/APZkbk9Nx/kz6lwJ4qR701vVM1G3OZDKlvejopCJgE mUuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance.com header.s=google header.b=My7sPeKG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=bytedance.com Return-Path: Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id 4-20020a170902e9c400b001c342073f76si5312046plk.323.2023.10.22.19.54.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 22 Oct 2023 19:54:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@bytedance.com header.s=google header.b=My7sPeKG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=bytedance.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id F35468065CEF; Sun, 22 Oct 2023 19:54:00 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233225AbjJWCxT (ORCPT + 99 others); Sun, 22 Oct 2023 22:53:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42880 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229481AbjJWCxT (ORCPT ); Sun, 22 Oct 2023 22:53:19 -0400 Received: from mail-pj1-x1031.google.com (mail-pj1-x1031.google.com [IPv6:2607:f8b0:4864:20::1031]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3BB76119 for ; Sun, 22 Oct 2023 19:53:17 -0700 (PDT) Received: by mail-pj1-x1031.google.com with SMTP id 98e67ed59e1d1-27d8a1aed37so946524a91.1 for ; Sun, 22 Oct 2023 19:53:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1698029597; x=1698634397; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=FxlrpfT+18WYqvl8iBNwHnQjJ9RP07edFblWvZMOgNU=; b=My7sPeKG9VK4TyD28ZSjcROpMdKRJKy/s1oJqWWfV1g3nsje76Tuc/zdhjuBY+OqGW AU9bQJen6xFf1tQ+873nDEfwKgcOsd+V+pSzWQvGbYxC2wAxln9mgoIgkeibBlXt7LGW P1+wPhFCwxpizeH+MEH3aHa4TKV1+a+JsOlmO22BFrF+Ec3Nf6g1Q2JyExLvLXWCEnDD glBG6IIt3ZUmaf+BDWvsSsv50XCztK+R0GIj4avbLwS8D4Ux4/FXxKdHbXdryPhijOx9 I4ZXUBNgjmI9h7FouBiEuG6cQ4xNMvAgpHspqKfsD1yu67bdUmFCAMmKjmEU8z6vL5NL 2xFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698029597; x=1698634397; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=FxlrpfT+18WYqvl8iBNwHnQjJ9RP07edFblWvZMOgNU=; b=v3W1IJWFCKDUCaaSGJawzQrd/CleoWPbAHEsmyb4v73/GrfL5Un+Dm85fgmYLvzpXv wbza3NTXEZcAIkQeIFwsN8U5OSVe5Ies7G3kUreNiWiEtacI1H3s82vwqgCWtTuOFcBF HKMYUJRZylVkUYjZL4svvDT/T6x1cASH3O0CJGL7R8p4Byo77SV5DV8jKhTRsnTd6Mth Qt/JqEC7Vd5UptEqiUcjNxR4bUJHETvy/LtOHLm7KDVQ15WGlItr2I4N17m5wNOYsp9/ x53WqUo06vel7+Ic8vIAZa8di3otKscTk32sT6Lb0WwLCidsJCBh8pwm5E1sW0IcwUau tM3Q== X-Gm-Message-State: AOJu0YxQLzVCC7N9oweTwSqDQ1DqFLJ+UYxzBVeDmw80Ak8K/KpOu+zW eRKjspl/gAinKYTxqhdKQTyDUA== X-Received: by 2002:a05:6a21:1a2:b0:171:947f:465b with SMTP id le34-20020a056a2101a200b00171947f465bmr12208058pzb.4.1698029596701; Sun, 22 Oct 2023 19:53:16 -0700 (PDT) Received: from [10.4.238.83] ([139.177.225.246]) by smtp.gmail.com with ESMTPSA id a7-20020aa794a7000000b006be484e5b9bsm5116413pfl.58.2023.10.22.19.53.11 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 22 Oct 2023 19:53:16 -0700 (PDT) Message-ID: Date: Mon, 23 Oct 2023 10:53:08 +0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v3 2/2] mm: memory_hotplug: drop memoryless node from fallback lists Content-Language: en-US To: "Huang, Ying" Cc: akpm@linux-foundation.org, rppt@kernel.org, david@redhat.com, vbabka@suse.cz, mhocko@suse.com, willy@infradead.org, mgorman@techsingularity.net, mingo@kernel.org, aneesh.kumar@linux.ibm.com, hannes@cmpxchg.org, osalvador@suse.de, linux-kernel@vger.kernel.org, linux-mm@kvack.org References: <9f1dbe7ee1301c7163b2770e32954ff5e3ecf2c4.1697711415.git.zhengqi.arch@bytedance.com> <87bkctg4f4.fsf@yhuang6-desk2.ccr.corp.intel.com> <4bfa007c-a20f-9e68-4a9f-935dacf43222@bytedance.com> <8734y2f868.fsf@yhuang6-desk2.ccr.corp.intel.com> From: Qi Zheng In-Reply-To: <8734y2f868.fsf@yhuang6-desk2.ccr.corp.intel.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Sun, 22 Oct 2023 19:54:01 -0700 (PDT) Hi Ying, On 2023/10/23 09:18, Huang, Ying wrote: > Qi Zheng writes: > >> Hi Ying, >> >> On 2023/10/20 15:05, Huang, Ying wrote: >>> Qi Zheng writes: >>> >>>> In offline_pages(), if a node becomes memoryless, we >>>> will clear its N_MEMORY state by calling node_states_clear_node(). >>>> But we do this after rebuilding the zonelists by calling >>>> build_all_zonelists(), which will cause this memoryless node to >>>> still be in the fallback list of other nodes. >>> For fallback list, do you mean pgdat->node_zonelists[]? If so, in >>> build_all_zonelists >>> __build_all_zonelists >>> build_zonelists >>> build_zonelists_in_node_order >>> build_zonerefs_node >>> populated_zone() will be checked before adding zone into zonelist. >>> So, IIUC, we will not try to allocate from the memory less node. >> >> Normally yes, but if it is the weird topology mentioned in [1], it's >> possible to allocate memory from it, it is a memoryless node, but it >> also has memory. >> >> In addition to the above case, I think it's reasonable to remove >> memory less node from node_order[] in advance. In this way it will >> not to be traversed in build_zonelists_in_node_order(). >> >> [1]. https://lore.kernel.org/all/20230212110305.93670-1-zhengqi.arch@bytedance.com/ > > Got it! Thank you for information. I think that it may be good to > include this in the patch description to avoid potential confusing in > the future. OK, maybe the commit message can be changed to the following: ``` In offline_pages(), if a node becomes memoryless, we will clear its N_MEMORY state by calling node_states_clear_node(). But we do this after rebuilding the zonelists by calling build_all_zonelists(), which will cause this memoryless node to still be in the fallback nodes (node_order[]) of other nodes. To drop memoryless nodes from fallback nodes in this case, just call node_states_clear_node() before calling build_all_zonelists(). In this way, we will not try to allocate pages from memoryless node0, then the panic mentioned in [1] will also be fixed. Even though this problem has been solved by dropping the NODE_MIN_SIZE constrain in x86 [2], it would be better to fix it in the core MM as well. [1]. https://lore.kernel.org/all/20230212110305.93670-1-zhengqi.arch@bytedance.com/ [2]. https://lore.kernel.org/all/20231017062215.171670-1-rppt@kernel.org/ ``` Thanks, Qi > > -- > Best Regards, > Huang, Ying > >> Thanks, >> Qi >> >> >>> -- >>> Best Regards, >>> Huang, Ying >>> >>>> This will incur >>>> some runtime overhead. >>>> >>>> To drop memoryless node from fallback lists in this case, just >>>> call node_states_clear_node() before calling build_all_zonelists(). >>>> >>>> Signed-off-by: Qi Zheng >>>> Acked-by: David Hildenbrand >>> [snip] >>> -- >>> Best Regards, >>> Huang, Ying