linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [Question] get_vma_policy() isn't compatible with {pin, get}_user_pages_remote
@ 2025-07-08  1:21 Jinjiang Tu
  2025-07-08  1:53 ` Huang, Ying
  0 siblings, 1 reply; 5+ messages in thread
From: Jinjiang Tu @ 2025-07-08  1:21 UTC (permalink / raw)
  To: Andrew Morton, David Hildenbrand, jgg, jhubbard, Peter Xu,
	Zi Yan, matthew.brost, joshua.hahnjy, rakie.kim, byungchul,
	gourry, ying.huang, apopple
  Cc: linux-mm, Kefeng Wang, tujinjiang

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.



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-07-09  4:25 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-07-08  1:21 [Question] get_vma_policy() isn't compatible with {pin, get}_user_pages_remote Jinjiang Tu
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox