linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Qi Zheng <zhengqi.arch@bytedance.com>
To: "Huang, Ying" <ying.huang@intel.com>
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
Subject: Re: [PATCH v3 2/2] mm: memory_hotplug: drop memoryless node from fallback lists
Date: Mon, 23 Oct 2023 10:53:08 +0800	[thread overview]
Message-ID: <b6319738-0d71-4083-a5db-845430b8a5d8@bytedance.com> (raw)
In-Reply-To: <8734y2f868.fsf@yhuang6-desk2.ccr.corp.intel.com>

Hi Ying,

On 2023/10/23 09:18, Huang, Ying wrote:
> Qi Zheng <zhengqi.arch@bytedance.com> writes:
> 
>> Hi Ying,
>>
>> On 2023/10/20 15:05, Huang, Ying wrote:
>>> Qi Zheng <zhengqi.arch@bytedance.com> 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 <zhengqi.arch@bytedance.com>
>>>> Acked-by: David Hildenbrand <david@redhat.com>
>>> [snip]
>>> --
>>> Best Regards,
>>> Huang, Ying


  reply	other threads:[~2023-10-23  2:53 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-19 10:43 [PATCH v3 0/2] handle memoryless nodes more appropriately Qi Zheng
2023-10-19 10:43 ` [PATCH v3 1/2] mm: page_alloc: skip memoryless nodes entirely Qi Zheng
2023-10-20  8:31   ` Ingo Molnar
2023-10-20  9:09     ` Qi Zheng
2023-10-19 10:43 ` [PATCH v3 2/2] mm: memory_hotplug: drop memoryless node from fallback lists Qi Zheng
2023-10-20  7:05   ` Huang, Ying
2023-10-20  7:35     ` Qi Zheng
2023-10-23  1:18       ` Huang, Ying
2023-10-23  2:53         ` Qi Zheng [this message]
2023-10-23  3:10           ` Huang, Ying
2023-10-23  3:17             ` Qi Zheng
2023-10-23 18:19               ` Andrew Morton
2023-10-20  8:32   ` Ingo Molnar
2023-10-20  9:10     ` Qi Zheng

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b6319738-0d71-4083-a5db-845430b8a5d8@bytedance.com \
    --to=zhengqi.arch@bytedance.com \
    --cc=akpm@linux-foundation.org \
    --cc=aneesh.kumar@linux.ibm.com \
    --cc=david@redhat.com \
    --cc=hannes@cmpxchg.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mgorman@techsingularity.net \
    --cc=mhocko@suse.com \
    --cc=mingo@kernel.org \
    --cc=osalvador@suse.de \
    --cc=rppt@kernel.org \
    --cc=vbabka@suse.cz \
    --cc=willy@infradead.org \
    --cc=ying.huang@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox