[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CADrL8HXHe85Jgiv9JatzMUhmqg0K5WGrGe_S+aZHobqzDYFLFQ@mail.gmail.com>
Date: Thu, 19 Jan 2023 15:06:27 -0800
From: James Houghton <jthoughton@...gle.com>
To: Peter Xu <peterx@...hat.com>
Cc: Mike Kravetz <mike.kravetz@...cle.com>,
Muchun Song <songmuchun@...edance.com>,
David Hildenbrand <david@...hat.com>,
David Rientjes <rientjes@...gle.com>,
Axel Rasmussen <axelrasmussen@...gle.com>,
Mina Almasry <almasrymina@...gle.com>,
"Zach O'Keefe" <zokeefe@...gle.com>,
Manish Mishra <manish.mishra@...anix.com>,
Naoya Horiguchi <naoya.horiguchi@....com>,
"Dr . David Alan Gilbert" <dgilbert@...hat.com>,
"Matthew Wilcox (Oracle)" <willy@...radead.org>,
Vlastimil Babka <vbabka@...e.cz>,
Baolin Wang <baolin.wang@...ux.alibaba.com>,
Miaohe Lin <linmiaohe@...wei.com>,
Yang Shi <shy828301@...il.com>,
Andrew Morton <akpm@...ux-foundation.org>, linux-mm@...ck.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 35/46] hugetlb: add MADV_COLLAPSE for hugetlb
On Thu, Jan 19, 2023 at 2:37 PM Peter Xu <peterx@...hat.com> wrote:
>
> On Thu, Jan 05, 2023 at 10:18:33AM +0000, James Houghton wrote:
> > + /*
> > + * Grab the VMA lock and mapping sem for writing. This will prevent
> > + * concurrent high-granularity page table walks, so that we can safely
> > + * collapse and free page tables.
> > + *
> > + * This is the same locking that huge_pmd_unshare requires.
> > + */
> > + hugetlb_vma_lock_write(vma);
> > + i_mmap_lock_write(vma->vm_file->f_mapping);
>
> One thing I just noticed - do we need the mmap write lock here? I don't
> quickly see what stops another thread from having the mmap read and walking
> upon the pgtables being collapsed.
Maybe. Does huge_pmd_unshare() have the same problem?
Powered by blists - more mailing lists