[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aa671279-c874-aedd-667f-e3a604bb0d67@shipmail.org>
Date: Thu, 3 Oct 2019 13:32:09 +0200
From: Thomas Hellström (VMware)
<thomas_os@...pmail.org>
To: "Kirill A. Shutemov" <kirill@...temov.name>
Cc: linux-mm@...ck.org, linux-kernel@...r.kernel.org,
torvalds@...ux-foundation.org,
Thomas Hellstrom <thellstrom@...are.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Matthew Wilcox <willy@...radead.org>,
Will Deacon <will.deacon@....com>,
Peter Zijlstra <peterz@...radead.org>,
Rik van Riel <riel@...riel.com>,
Minchan Kim <minchan@...nel.org>,
Michal Hocko <mhocko@...e.com>,
Huang Ying <ying.huang@...el.com>,
Jérôme Glisse <jglisse@...hat.com>
Subject: Re: [PATCH v3 1/7] mm: Remove BUG_ON mmap_sem not held from
xxx_trans_huge_lock()
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 <thellstrom@...are.com>
>>
>> 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 <akpm@...ux-foundation.org>
>> Cc: Matthew Wilcox <willy@...radead.org>
>> Cc: Will Deacon <will.deacon@....com>
>> Cc: Peter Zijlstra <peterz@...radead.org>
>> Cc: Rik van Riel <riel@...riel.com>
>> Cc: Minchan Kim <minchan@...nel.org>
>> Cc: Michal Hocko <mhocko@...e.com>
>> Cc: Huang Ying <ying.huang@...el.com>
>> Cc: Jérôme Glisse <jglisse@...hat.com>
>> Cc: Kirill A. Shutemov <kirill@...temov.name>
>> Signed-off-by: Thomas Hellstrom <thellstrom@...are.com>
> The patch looks good to me:
>
> Acked-by: Kirill A. Shutemov <kirill.shutemov@...ux.intel.com>
>
> 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
Powered by blists - more mailing lists