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] [day] [month] [year] [list]
Message-Id: <20080520160242.9533c2ee.kamezawa.hiroyu@jp.fujitsu.com>
Date:	Tue, 20 May 2008 16:02:42 +0900
From:	KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>
To:	Andrew Morton <akpm@...ux-foundation.org>
Cc:	Johannes Weiner <hannes@...urebad.de>,
	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
	linux-mm@...ck.org
Subject: Re: Possible partial miss in pages needed for zone's memory map?

On Mon, 19 May 2008 23:19:37 -0700
Andrew Morton <akpm@...ux-foundation.org> wrote:

> On Sat, 17 May 2008 14:19:15 +0200 Johannes Weiner <hannes@...urebad.de> wrote:
> 
> > Hi,
> > 
> > I stumbled over the following in the zone initialization code.  Please
> > let me know if I overlooked something here.
> > 
> 
> hm, no takers.  Let's add linux-mm.
> 
> > 
> > From: Johannes Weiner <hannes@...urebad.de>
> > Subject: [PATCH] Don't drop a partial page in a zone's memory map size
> > 
> > In a zone's present pages number, account for all pages occupied by the
> > memory map, including a partial.
> > 
> > Signed-off-by: Johannes Weiner <hannes@...urebad.de>
> > ---
> > 
> > --- a/mm/page_alloc.c
> > +++ b/mm/page_alloc.c
> > @@ -3378,7 +3378,8 @@ static void __paginginit free_area_init_
> >  		 * is used by this zone for memmap. This affects the watermark
> >  		 * and per-cpu initialisations
> >  		 */
> > -		memmap_pages = (size * sizeof(struct page)) >> PAGE_SHIFT;
> > +		memmap_pages =
> > +			PAGE_ALIGN(size * sizeof(struct page)) >> PAGE_SHIFT;
> >  		if (realsize >= memmap_pages) {
> >  			realsize -= memmap_pages;
> >  			printk(KERN_DEBUG
> 
> I looked in there for 30 seconds and collapsed in confusion over which
> variables are in which units.
> 
Hmm, size * sizeof(struct page) is  multiple of PAGE_SIZE in many case.
Becasue "size" is always alinged to (1 << MAX_ORDER -1) (I believe...).

ex.) In x86 case,
   (1 << (MAX_ORDER(11) - 1)) * 4 (sizeof(long)) = (1 << 12) = PAGE_SIZE.

But not sure on other archs with various params.
I think above fix is correct.

Thanks,
-Kame

--
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