From: Jinjiang Tu <tujinjiang@huawei.com>
To: Andrew Morton <akpm@linux-foundation.org>,
David Hildenbrand <david@redhat.com>, <jgg@nvidia.com>,
<jhubbard@nvidia.com>, Peter Xu <peterx@redhat.com>,
Zi Yan <ziy@nvidia.com>, <matthew.brost@intel.com>,
<joshua.hahnjy@gmail.com>, <rakie.kim@sk.com>, <byungchul@sk.com>,
<gourry@gourry.net>, <ying.huang@linux.alibaba.com>,
<apopple@nvidia.com>
Cc: <linux-mm@kvack.org>, Kefeng Wang <wangkefeng.wang@huawei.com>,
<tujinjiang@huawei.com>
Subject: [Question] get_vma_policy() isn't compatible with {pin, get}_user_pages_remote
Date: Tue, 8 Jul 2025 09:21:57 +0800 [thread overview]
Message-ID: <94a3d35d-0872-5696-0333-7273f4a69979@huawei.com> (raw)
get_vma_policy() returns the mempolicy for the vma. If the vma has set
mempolicy, the policy is returned. Otherwise,
call get_task_policy(current) to get the mempolicy of current task.
However, it isn't reasonable for
pin_user_pages_remote() and get_user_pages_remote() cases.
Assume task A calls pin_user_pages_remote() to pin user pages from task
B. If the [start, start + nr_pages) isn't
populated with pages, handle_mm_fault() will be called by task A.
However, if the vma doesn't set memory policy,
the mempolicy of task A instead of task B is used to allocate. It seems
to be unreasonable. See
dequeue_hugetlb_folio_vma()->huge_node().
We can only obtain mm in get_vma_policy(), but we couldn't get the task,
since a mm can be associated with multiple
tasks(threads) and the task mempolicy is at thread granularity.
Is this situation reasonable? And if not, how could we fix it?
Thanks.
next reply other threads:[~2025-07-08 1:22 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-08 1:21 Jinjiang Tu [this message]
2025-07-08 1:53 ` Huang, Ying
2025-07-08 2:51 ` Jinjiang Tu
2025-07-08 3:05 ` Huang, Ying
2025-07-09 4:25 ` Jinjiang Tu
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=94a3d35d-0872-5696-0333-7273f4a69979@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=jgg@nvidia.com \
--cc=jhubbard@nvidia.com \
--cc=joshua.hahnjy@gmail.com \
--cc=linux-mm@kvack.org \
--cc=matthew.brost@intel.com \
--cc=peterx@redhat.com \
--cc=rakie.kim@sk.com \
--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