All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dave Hansen <dave@linux.vnet.ibm.com>
To: Michal Nazarewicz <mina86@mina86.com>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	Timur Tabi <timur@freescale.com>,
	Andi Kleen <andi@firstfloor.org>, Mel Gorman <mel@csn.ul.ie>,
	Andrew Morton <akpm@linux-foundation.org>,
	David Rientjes <rientjes@google.com>
Subject: Re: [PATCH 3/3] reuse __free_pages_exact() in __alloc_pages_exact()
Date: Tue, 12 Apr 2011 08:24:24 -0700	[thread overview]
Message-ID: <1302621864.8321.1856.camel@nimitz> (raw)
In-Reply-To: <op.vttl33xz3l0zgt@mnazarewicz-glaptop>

On Tue, 2011-04-12 at 12:29 +0200, Michal Nazarewicz wrote:
> On Tue, 12 Apr 2011 00:03:48 +0200, Dave Hansen <dave@linux.vnet.ibm.com>  
> wrote:
> > diff -puN mm/page_alloc.c~reuse-free-exact mm/page_alloc.c
> > --- linux-2.6.git/mm/page_alloc.c~reuse-free-exact	2011-04-11  
> > 15:01:17.701822598 -0700
> > +++ linux-2.6.git-dave/mm/page_alloc.c	2011-04-11 15:01:17.713822594  
> > -0700
> > @@ -2338,14 +2338,11 @@ struct page *__alloc_pages_exact(gfp_t g
> > 	page = alloc_pages(gfp_mask, order);
> >  	if (page) {
> > -		struct page *alloc_end = page + (1 << order);
> > -		struct page *used = page + nr_pages;
> > +		struct page *unused_start = page + nr_pages;
> > +		int nr_unused = (1 << order) - nr_pages;
> 
> How about unsigned long?

Personally, I'd rather leave this up to the poor sucker that tries to
set MAX_ORDER to 33.  If someone did that, we'd end up with kernels that
couldn't even boot on systems with less than 16GB of RAM since the
(required) flatmem mem_map[] would take up ~14.3GB.  They couldn't
handle memory holes and couldn't be NUMA-aware, either. 

So, if someone had a system like that, fixed up all the other spots
where we store numbers of pages in ints, and then did an 8TB+4k
allocation, yes, this would matter.  I'd rather save the 10 bytes of
source code and 4 bytes of stack than account for such an impossibly
improbable system.

-- Dave


WARNING: multiple messages have this Message-ID (diff)
From: Dave Hansen <dave@linux.vnet.ibm.com>
To: Michal Nazarewicz <mina86@mina86.com>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	Timur Tabi <timur@freescale.com>,
	Andi Kleen <andi@firstfloor.org>, Mel Gorman <mel@csn.ul.ie>,
	Andrew Morton <akpm@linux-foundation.org>,
	David Rientjes <rientjes@google.com>
Subject: Re: [PATCH 3/3] reuse __free_pages_exact() in __alloc_pages_exact()
Date: Tue, 12 Apr 2011 08:24:24 -0700	[thread overview]
Message-ID: <1302621864.8321.1856.camel@nimitz> (raw)
In-Reply-To: <op.vttl33xz3l0zgt@mnazarewicz-glaptop>

On Tue, 2011-04-12 at 12:29 +0200, Michal Nazarewicz wrote:
> On Tue, 12 Apr 2011 00:03:48 +0200, Dave Hansen <dave@linux.vnet.ibm.com>  
> wrote:
> > diff -puN mm/page_alloc.c~reuse-free-exact mm/page_alloc.c
> > --- linux-2.6.git/mm/page_alloc.c~reuse-free-exact	2011-04-11  
> > 15:01:17.701822598 -0700
> > +++ linux-2.6.git-dave/mm/page_alloc.c	2011-04-11 15:01:17.713822594  
> > -0700
> > @@ -2338,14 +2338,11 @@ struct page *__alloc_pages_exact(gfp_t g
> > 	page = alloc_pages(gfp_mask, order);
> >  	if (page) {
> > -		struct page *alloc_end = page + (1 << order);
> > -		struct page *used = page + nr_pages;
> > +		struct page *unused_start = page + nr_pages;
> > +		int nr_unused = (1 << order) - nr_pages;
> 
> How about unsigned long?

Personally, I'd rather leave this up to the poor sucker that tries to
set MAX_ORDER to 33.  If someone did that, we'd end up with kernels that
couldn't even boot on systems with less than 16GB of RAM since the
(required) flatmem mem_map[] would take up ~14.3GB.  They couldn't
handle memory holes and couldn't be NUMA-aware, either. 

So, if someone had a system like that, fixed up all the other spots
where we store numbers of pages in ints, and then did an 8TB+4k
allocation, yes, this would matter.  I'd rather save the 10 bytes of
source code and 4 bytes of stack than account for such an impossibly
improbable system.

-- Dave

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2011-04-12 15:24 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-11 22:03 [PATCH 1/3] rename alloc_pages_exact() Dave Hansen
2011-04-11 22:03 ` Dave Hansen
2011-04-11 22:03 ` [PATCH 2/3] make new alloc_pages_exact() Dave Hansen
2011-04-11 22:03   ` Dave Hansen
2011-04-11 22:22   ` Andrew Morton
2011-04-11 22:22     ` Andrew Morton
2011-04-11 22:36     ` Dave Hansen
2011-04-11 22:36       ` Dave Hansen
2011-04-11 22:42       ` Timur Tabi
2011-04-11 22:42         ` Timur Tabi
2011-04-12 10:28     ` Michal Nazarewicz
2011-04-12 10:28       ` Michal Nazarewicz
2011-04-12 15:04       ` Dave Hansen
2011-04-12 15:04         ` Dave Hansen
2011-04-12 15:58         ` Michal Nazarewicz
2011-04-12 15:58           ` Michal Nazarewicz
2011-04-13 23:23           ` Dave Hansen
2011-04-13 23:23             ` Dave Hansen
2011-04-11 22:03 ` [PATCH 3/3] reuse __free_pages_exact() in __alloc_pages_exact() Dave Hansen
2011-04-11 22:03   ` Dave Hansen
2011-04-12 10:29   ` Michal Nazarewicz
2011-04-12 10:29     ` Michal Nazarewicz
2011-04-12 15:24     ` Dave Hansen [this message]
2011-04-12 15:24       ` Dave Hansen
2011-04-12 15:57       ` Michal Nazarewicz
2011-04-12 15:57         ` Michal Nazarewicz
2011-04-12 17:07 ` [PATCH 1/3] rename alloc_pages_exact() Namhyung Kim
2011-04-12 17:07   ` Namhyung Kim
2011-04-12 17:11   ` Dave Hansen
2011-04-12 17:11     ` Dave Hansen
  -- strict thread matches above, loose matches on Subject: below --
2011-04-14 20:01 Dave Hansen
2011-04-14 20:01 ` [PATCH 3/3] reuse __free_pages_exact() in __alloc_pages_exact() Dave Hansen
2011-04-14 20:01   ` Dave Hansen
2011-04-14 22:00   ` David Rientjes
2011-04-14 22:00     ` David Rientjes
2011-04-14 22:07     ` Dave Hansen
2011-04-14 22:07       ` Dave Hansen
2011-04-14 22:09       ` David Rientjes
2011-04-14 22:09         ` David Rientjes

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1302621864.8321.1856.camel@nimitz \
    --to=dave@linux.vnet.ibm.com \
    --cc=akpm@linux-foundation.org \
    --cc=andi@firstfloor.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mel@csn.ul.ie \
    --cc=mina86@mina86.com \
    --cc=rientjes@google.com \
    --cc=timur@freescale.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.