From: Jinjiang Tu <tujinjiang@huawei.com>
To: Joshua Hahn <joshua.hahnjy@gmail.com>, Michal Hocko <mhocko@suse.com>
Cc: <rientjes@google.com>, <shakeel.butt@linux.dev>,
<akpm@linux-foundation.org>, <david@redhat.com>, <ziy@nvidia.com>,
<matthew.brost@intel.com>, <rakie.kim@sk.com>, <byungchul@sk.com>,
<gourry@gourry.net>, <ying.huang@linux.alibaba.com>,
<apopple@nvidia.com>, <linux-mm@kvack.org>,
<wangkefeng.wang@huawei.com>
Subject: Re: [PATCH] mm/oom_kill: kill current in OOM when binding to cpu-less nodes
Date: Fri, 5 Sep 2025 10:05:21 +0800 [thread overview]
Message-ID: <686cf134-7682-4871-a561-b8dba019f5ce@huawei.com> (raw)
In-Reply-To: <20250904144301.1224021-1-joshua.hahnjy@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 2930 bytes --]
在 2025/9/4 22:43, Joshua Hahn 写道:
> On Thu, 4 Sep 2025 16:36:28 +0200 Michal Hocko<mhocko@suse.com> wrote:
>
>> On Thu 04-09-25 07:26:25, Joshua Hahn wrote:
>>> On Thu, 4 Sep 2025 21:44:31 +0800 Jinjiang Tu<tujinjiang@huawei.com> wrote:
>>>
>>> Hello Jinjiang,
>>>
>>> I hope you are doing well, thank you for this patchset!
>>>
>>>> out_of_memory() selects tasks without considering mempolicy. Assuming a
>>>> cpu-less NUMA Node, ordinary process that don't set mempolicy don't
>>>> allocate memory from this cpu-less Node, unless other NUMA Nodes are below
>>>> low watermark. If a task binds to this cpu-less Node and triggers OOM, many
>>>> tasks may be killed wrongly that don't occupy memory from this Node.
>>> I am wondeirng whether you have seen this happen in practice, or if this is
>>> just based on inspecting the code. I have a feeling that the case you are
>>> concerned about may already be covered in select_bad_process.
>>>
>>> out_of_memory(oc)
>>> select_bad_process(oc)
>>> oom_evaluate_task(p, oc)
>>> oom_cpuset_eligible(task, oc)
>>>
>>> [...snip...]
>>>
>>> for_each_thread(start, tsk) {
>>> if (mask) {
>>> ret = mempolicy_in_oom_domain(tsk, mask);
>>> } else {
>>> ret = cpuset_mems_allowed_intersects(current, tsk)
>>> }
>>> }
>>>
>>> While iterating through the list of candidate processes, we check whether
>>> oc->nodemask exists, and if not, we check if the nodemasks intersects. It seems
>>> like these are the two checks that you add in the helper function.
>>>
>>> With that said, I might be missing something obvious -- please feel to
>>> correct me if I am misunderstanding your patch or if I'm missing something
>>> in the existing oom target selection : -)
>> The thing with mempolicy_in_oom_domain is that it doesn't really do what
>> you might be thinking it is doing ;) as it will true also for tasks
>> without any NUMA affinity because those intersect with the given mask by
>> definition as they can allocate from any node. So they are eligible and
>> that is what Jinjiang Tu is considered about I believe.
> Hello Michal! Thank you for your insights : -)
>
> Looking back, I made the mistake of thinking that we cared about the
> !oc->nodemask case, where Jinjiang's patch cares about the oc->nodemask == True
> case. So I was checking that cpuset_mems_allowed_intersects was the same as
> nodes_intersects, whereas I should have been checking if mempolicy_in_oom_domain
> is correct.
Most tasks don't mbind to specific nodes. In our use case, as described in the reply
to Michal, ordinary tasks are unlikely to allocate from these cpu-less NUMA Nodes.
>
> Looking into it, everything you said is correct and I think I defintely
> overlooked what the patch was trying to do. Thank you for clarifying these
> points for me!
>
> I hope you have a great day,
> Joshua
>
>> --
>> Michal Hocko
>> SUSE Labs
[-- Attachment #2: Type: text/html, Size: 4013 bytes --]
next prev parent reply other threads:[~2025-09-05 2:06 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-04 13:44 Jinjiang Tu
2025-09-04 14:25 ` Michal Hocko
2025-09-05 1:56 ` Jinjiang Tu
2025-09-05 8:08 ` Michal Hocko
2025-09-05 8:18 ` Jinjiang Tu
2025-09-05 9:10 ` Michal Hocko
2025-09-05 9:25 ` Jinjiang Tu
2025-09-05 9:42 ` Michal Hocko
2025-09-06 1:56 ` Jinjiang Tu
2025-09-08 7:46 ` Michal Hocko
2025-09-08 8:16 ` Jinjiang Tu
2025-09-08 9:11 ` Michal Hocko
2025-09-08 11:07 ` Jinjiang Tu
2025-09-08 11:13 ` Jinjiang Tu
2025-09-08 11:26 ` Michal Hocko
2025-09-05 9:13 ` Michal Hocko
2025-09-04 14:26 ` Joshua Hahn
2025-09-04 14:36 ` Michal Hocko
2025-09-04 14:43 ` Joshua Hahn
2025-09-05 2:05 ` Jinjiang Tu [this message]
2025-09-08 17:50 ` Gregory Price
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=686cf134-7682-4871-a561-b8dba019f5ce@huawei.com \
--to=tujinjiang@huawei.com \
--cc=akpm@linux-foundation.org \
--cc=apopple@nvidia.com \
--cc=byungchul@sk.com \
--cc=david@redhat.com \
--cc=gourry@gourry.net \
--cc=joshua.hahnjy@gmail.com \
--cc=linux-mm@kvack.org \
--cc=matthew.brost@intel.com \
--cc=mhocko@suse.com \
--cc=rakie.kim@sk.com \
--cc=rientjes@google.com \
--cc=shakeel.butt@linux.dev \
--cc=wangkefeng.wang@huawei.com \
--cc=ying.huang@linux.alibaba.com \
--cc=ziy@nvidia.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