lkml.org 
[lkml]   [2019]   [Aug]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] hugetlbfs: fix hugetlb page migration/fault race causing SIGBUS
From
Date
On 8/7/19 7:24 PM, 裘稀石(稀石) wrote:
> Hi Mike,
>
> Do you mean the similar race is like the following?
>
> migration clearing the pte
> page fault(before we return error, and now we return 0, then try page fault again, right?)
> migration writing a migration entry

Yes, something like the that. The change is to takes the page table lock
to examine the pte before returning. If the pte is clear when examined
while holding the lock, an error will be returned as before. If not clear,
then we return zero and try again.

This change adds code which is very much like this check further in
the routine hugetlb_no_page():

ptl = huge_pte_lock(h, mm, ptep);
size = i_size_read(mapping->host) >> huge_page_shift(h);
if (idx >= size)
goto backout;

ret = 0;
if (!huge_pte_none(huge_ptep_get(ptep)))
goto backout;

--
Mike Kravetz

\
 
 \ /
  Last update: 2019-08-08 04:47    [W:0.032 / U:1.340 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site