From: Philip Yang Date: Thu, 23 May 2019 20:32:31 +0000 (-0400) Subject: mm/hmm: support automatic NUMA balancing X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=789c2af88f24d1db983aae49b5c4561e6e02ff5b;p=linux.git mm/hmm: support automatic NUMA balancing While the page is migrating by NUMA balancing, HMM failed to detect this condition and still return the old page. Application will use the new page migrated, but driver pass the old page physical address to GPU, this crash the application later. Use pte_protnone(pte) to return this condition and then hmm_vma_do_fault will allocate new page. Signed-off-by: Philip Yang Signed-off-by: Felix Kuehling Reviewed-by: Jérôme Glisse Signed-off-by: Jason Gunthorpe --- diff --git a/mm/hmm.c b/mm/hmm.c index 4db5dcf110ba6..dce4e70e648a9 100644 --- a/mm/hmm.c +++ b/mm/hmm.c @@ -548,7 +548,7 @@ static int hmm_vma_handle_pmd(struct mm_walk *walk, static inline uint64_t pte_to_hmm_pfn_flags(struct hmm_range *range, pte_t pte) { - if (pte_none(pte) || !pte_present(pte)) + if (pte_none(pte) || !pte_present(pte) || pte_protnone(pte)) return 0; return pte_write(pte) ? range->flags[HMM_PFN_VALID] | range->flags[HMM_PFN_WRITE] :