[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMZfGtX2p_M15i0pE7tTu3amPNof5PW2jJFUnXtGdGRyGydAtw@mail.gmail.com>
Date: Tue, 27 Oct 2020 10:58:36 +0800
From: Muchun Song <songmuchun@...edance.com>
To: Matthew Wilcox <willy@...radead.org>
Cc: Jonathan Corbet <corbet@....net>,
Mike Kravetz <mike.kravetz@...cle.com>,
Thomas Gleixner <tglx@...utronix.de>, mingo@...hat.com,
bp@...en8.de, x86@...nel.org, hpa@...or.com,
dave.hansen@...ux.intel.com, luto@...nel.org,
Peter Zijlstra <peterz@...radead.org>, viro@...iv.linux.org.uk,
Andrew Morton <akpm@...ux-foundation.org>, paulmck@...nel.org,
mchehab+huawei@...nel.org, pawan.kumar.gupta@...ux.intel.com,
Randy Dunlap <rdunlap@...radead.org>, oneukum@...e.com,
anshuman.khandual@....com, jroedel@...e.de,
Mina Almasry <almasrymina@...gle.com>,
David Rientjes <rientjes@...gle.com>,
Xiongchun duan <duanxiongchun@...edance.com>,
linux-doc@...r.kernel.org, LKML <linux-kernel@...r.kernel.org>,
Linux Memory Management List <linux-mm@...ck.org>,
linux-fsdevel <linux-fsdevel@...r.kernel.org>
Subject: Re: [External] Re: [PATCH v2 07/19] mm/hugetlb: Free the vmemmap
pages associated with each hugetlb page
On Tue, Oct 27, 2020 at 12:01 AM Matthew Wilcox <willy@...radead.org> wrote:
>
> On Mon, Oct 26, 2020 at 10:51:02PM +0800, Muchun Song wrote:
> > +static void split_vmemmap_pmd(pmd_t *pmd, pte_t *pte_p, unsigned long addr)
> > +{
> > + struct mm_struct *mm = &init_mm;
> > + struct page *page;
> > + pmd_t old_pmd, _pmd;
> > + int i;
> > +
> > + old_pmd = READ_ONCE(*pmd);
> > + page = pmd_page(old_pmd);
> > + pmd_populate_kernel(mm, &_pmd, pte_p);
> > +
> > + for (i = 0; i < VMEMMAP_HPAGE_NR; i++, addr += PAGE_SIZE) {
> > + pte_t entry, *pte;
> > +
> > + entry = mk_pte(page + i, PAGE_KERNEL);
>
> I'd be happier if that were:
>
> pgprot_t pgprot = PAGE_KERNEL;
> ...
> for (i = 0; i < VMEMMAP_HPAGE_NR; i++, addr += PAGE_SIZE) {
> pte_t entry, *pte;
>
> entry = mk_pte(page + i, pgprot);
> pgprot = PAGE_KERNEL_RO;
>
> so that all subsequent tail pages are mapped read-only.
>
Good idea, do this can catch some illegal operations. Thanks.
--
Yours,
Muchun
Powered by blists - more mailing lists