lkml.org 
[lkml]   [2020]   [Oct]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [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@infradead.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

\
 
 \ /
  Last update: 2020-10-27 04:00    [W:0.156 / U:0.108 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site