Hi, Kirill,
On 10/3/19 1:02 PM, Kirill A. Shutemov wrote:
On Wed, Oct 02, 2019 at 03:47:24PM +0200, Thomas Hellström (VMware) wrote:
From: Thomas Hellstrom <[email protected]>
The caller needs to make sure that the vma is not torn down during the
lock operation and can also use the i_mmap_rwsem for file-backed vmas.
Remove the BUG_ON. We could, as an alternative, add a test that either
vma->vm_mm->mmap_sem or vma->vm_file->f_mapping->i_mmap_rwsem are held.
Cc: Andrew Morton <[email protected]>
Cc: Matthew Wilcox <[email protected]>
Cc: Will Deacon <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Rik van Riel <[email protected]>
Cc: Minchan Kim <[email protected]>
Cc: Michal Hocko <[email protected]>
Cc: Huang Ying <[email protected]>
Cc: Jérôme Glisse <[email protected]>
Cc: Kirill A. Shutemov <[email protected]>
Signed-off-by: Thomas Hellstrom <[email protected]>
The patch looks good to me:
Acked-by: Kirill A. Shutemov <[email protected]>
But I looked at usage at pagewalk.c and it is inconsitent. The walker
takes ptl before calling ->pud_entry(), but not for ->pmd_entry().
It should be fixed: do not take the lock before ->pud_entry(). The
callback must take care of it.
Looks like we have single ->pud_entry() implementation the whole kernel.
It should be trivial to fix.
Could you do this?
I could probably fix that. There are some comments in the patch
introducing that code as to why it was done that way, though, but I
don't remember offhand what the arguments were.
But there seems to be more races WRT puds. See my next email. Perhaps
this should be fixed as part of a larger audit of the huge_pud code?
/Thomas