lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20121115080133.GA9676@otc-wbsnb-06>
Date:	Thu, 15 Nov 2012 10:01:33 +0200
From:	"Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>
To:	David Rientjes <rientjes@...gle.com>
Cc:	Andrew Morton <akpm@...ux-foundation.org>,
	Andrea Arcangeli <aarcange@...hat.com>, linux-mm@...ck.org,
	Andi Kleen <ak@...ux.intel.com>,
	"H. Peter Anvin" <hpa@...ux.intel.com>,
	linux-kernel@...r.kernel.org,
	"Kirill A. Shutemov" <kirill@...temov.name>
Subject: Re: [PATCH v5 03/11] thp: copy_huge_pmd(): copy huge zero page

On Wed, Nov 14, 2012 at 02:33:44PM -0800, David Rientjes wrote:
> On Wed, 7 Nov 2012, Kirill A. Shutemov wrote:
> 
> > diff --git a/mm/huge_memory.c b/mm/huge_memory.c
> > index ff834ea..0d903bf 100644
> > --- a/mm/huge_memory.c
> > +++ b/mm/huge_memory.c
> > @@ -701,6 +701,18 @@ static inline struct page *alloc_hugepage(int defrag)
> >  }
> >  #endif
> >  
> > +static void set_huge_zero_page(pgtable_t pgtable, struct mm_struct *mm,
> > +		struct vm_area_struct *vma, unsigned long haddr, pmd_t *pmd)
> > +{
> > +	pmd_t entry;
> > +	entry = pfn_pmd(huge_zero_pfn, vma->vm_page_prot);
> > +	entry = pmd_wrprotect(entry);
> > +	entry = pmd_mkhuge(entry);
> > +	set_pmd_at(mm, haddr, pmd, entry);
> > +	pgtable_trans_huge_deposit(mm, pgtable);
> > +	mm->nr_ptes++;
> > +}
> > +
> >  int do_huge_pmd_anonymous_page(struct mm_struct *mm, struct vm_area_struct *vma,
> >  			       unsigned long address, pmd_t *pmd,
> >  			       unsigned int flags)
> > @@ -778,6 +790,11 @@ int copy_huge_pmd(struct mm_struct *dst_mm, struct mm_struct *src_mm,
> >  		pte_free(dst_mm, pgtable);
> >  		goto out_unlock;
> >  	}
> > +	if (is_huge_zero_pmd(pmd)) {
> > +		set_huge_zero_page(pgtable, dst_mm, vma, addr, dst_pmd);
> > +		ret = 0;
> > +		goto out_unlock;
> > +	}
> 
> You said in the introduction message in this series that you still allow 
> splitting of the pmd, so why no check for pmd_trans_splitting() before 
> this?

pmd_trans_splitting() returns true only for pmd which points to a page
under spliiting. It never happens with huge zero page.
We only split a pmd to a page table without touching the page.
mm->page_table_lock is enough to protect against that.

-- 
 Kirill A. Shutemov

Download attachment "signature.asc" of type "application/pgp-signature" (837 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ