[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YuQbxTHGMWTbvahN@monkey>
Date: Fri, 29 Jul 2022 10:41:25 -0700
From: Mike Kravetz <mike.kravetz@...cle.com>
To: Miaohe Lin <linmiaohe@...wei.com>
Cc: linux-mm@...ck.org, linux-kernel@...r.kernel.org,
Muchun Song <songmuchun@...edance.com>,
Michal Hocko <mhocko@...e.com>, Peter Xu <peterx@...hat.com>,
Naoya Horiguchi <naoya.horiguchi@...ux.dev>,
David Hildenbrand <david@...hat.com>,
"Aneesh Kumar K . V" <aneesh.kumar@...ux.vnet.ibm.com>,
Andrea Arcangeli <aarcange@...hat.com>,
"Kirill A . Shutemov" <kirill.shutemov@...ux.intel.com>,
Davidlohr Bueso <dave@...olabs.net>,
Prakash Sangappa <prakash.sangappa@...cle.com>,
James Houghton <jthoughton@...gle.com>,
Mina Almasry <almasrymina@...gle.com>,
Pasha Tatashin <pasha.tatashin@...een.com>,
Axel Rasmussen <axelrasmussen@...gle.com>,
Ray Fucillo <Ray.Fucillo@...ersystems.com>,
Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [RFC PATCH v4 8/8] hugetlb: use new vma_lock for pmd sharing
synchronization
On 07/29/22 09:41, Miaohe Lin wrote:
> On 2022/7/29 1:47, Mike Kravetz wrote:
> > On 07/28/22 14:51, Miaohe Lin wrote:
> snip
> >>
> >> Do we need to check &mm->mm_users == 0 here in case the address_space of corresponding process
> >> has exited? In this case, mmdrop will drop the last reference and free the skipped_mm. So we will
> >> use skipped_mm below after it's freed?
> >>
> >
> > Good point!
> > I think we need to wait to drop since we want to hold the read lock.
> > Will update.
> >
> >>> + vma = find_vma(skipped_mm, skipped_vm_start);
> >>> + if (!vma || vma->vm_file->f_mapping != mapping ||
> >>
> >> If skipped_vm_start is unmapped and remapped as a anon vma before we taking the mmap_read_lock,
> >> vma->vm_file will be NULL?
> >>
> >
> > IIUC, vma->vm_file will always be set even for an anon vma. The fault
> > code depends on this. See beginning of hugetlb_fault() where we
> > unconditionally do:
> >
> > mapping = vma->vm_file->f_mapping;
>
> What if vma is non-hugetlb anon vma?
>
Right. The first check after !vma should be for hugetlb as we do not
care if non-hugetlb vmas and want to quit. Something like,
vma = find_vma(skipped_mm, skipped_vm_start);
if (!vma || !is_vm_hugetlb_page(vma) ||
--
Mike Kravetz
Powered by blists - more mailing lists