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: <1302268786.8184.6879.camel@nimitz>
Date:	Fri, 08 Apr 2011 06:19:46 -0700
From:	Dave Hansen <dave@...ux.vnet.ibm.com>
To:	Michal Nazarewicz <mina86@...a86.com>
Cc:	linux-mm@...ck.org, linux-kernel@...r.kernel.org,
	Timur Tabi <timur@...escale.com>,
	Andi Kleen <andi@...stfloor.org>, Mel Gorman <mel@....ul.ie>,
	Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [PATCH 2/2] make new alloc_pages_exact()

On Fri, 2011-04-08 at 14:28 +0200, Michal Nazarewicz wrote:
> On Thu, 07 Apr 2011 19:21:05 +0200, Dave Hansen <dave@...ux.vnet.ibm.com>  
> wrote:
> > +struct page *__alloc_pages_exact(gfp_t gfp_mask, size_t size)
> >  {
> >  	unsigned int order = get_order(size);
> > -	unsigned long addr;
> > +	struct page *page;
> > -	addr = __get_free_pages(gfp_mask, order);
> > -	if (addr) {
> > -		unsigned long alloc_end = addr + (PAGE_SIZE << order);
> > -		unsigned long used = addr + PAGE_ALIGN(size);
> > +	page = alloc_pages(gfp_mask, order);
> > +	if (page) {
> > +		struct page *alloc_end = page + (1 << order);
> > +		struct page *used = page + PAGE_ALIGN(size)/PAGE_SIZE;
> > -		split_page(virt_to_page((void *)addr), order);
> > +		split_page(page, order);
> >  		while (used < alloc_end) {
> > -			free_page(used);
> > -			used += PAGE_SIZE;
> > +			__free_page(used);
> > +			used++;
> >  		}
> 
> Have you thought about moving this loop to a separate function, ie.
> _free_page_range(start, end)?  I'm asking because this loop appears
> in two places and my CMA would also benefit from such a function.

Sounds like a good idea to me.  Were you thinking start/end 'struct
page's as arguments?

-- Dave

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ