linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Nick Piggin <nickpiggin@yahoo.com.au>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Andy Whitcroft <apw@shadowen.org>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	kniht@linux.vnet.ibm.com, mel@csn.ul.ie
Subject: Re: [PATCH 1/1] handle initialising compound pages at orders greater than MAX_ORDER
Date: Fri, 3 Oct 2008 16:43:28 +1000	[thread overview]
Message-ID: <200810031643.28731.nickpiggin@yahoo.com.au> (raw)
In-Reply-To: <20081002143004.5fec3952.akpm@linux-foundation.org>

On Friday 03 October 2008 07:30, Andrew Morton wrote:
> On Thu,  2 Oct 2008 17:19:56 +0100
>
> Andy Whitcroft <apw@shadowen.org> wrote:
> > --- a/mm/page_alloc.c
> > +++ b/mm/page_alloc.c
> > @@ -268,13 +268,14 @@ void prep_compound_page(struct page *page, unsigned
> > long order) {
> >  	int i;
> >  	int nr_pages = 1 << order;
> > +	struct page *p = page + 1;
> >
> >  	set_compound_page_dtor(page, free_compound_page);
> >  	set_compound_order(page, order);
> >  	__SetPageHead(page);
> > -	for (i = 1; i < nr_pages; i++) {
> > -		struct page *p = page + i;
> > -
> > +	for (i = 1; i < nr_pages; i++, p++) {
> > +		if (unlikely((i & (MAX_ORDER_NR_PAGES - 1)) == 0))
> > +			p = pfn_to_page(page_to_pfn(page) + i);
> >  		__SetPageTail(p);
> >  		p->first_page = page;
> >  	}
>
> gad.  Wouldn't it be clearer to do
>
> 	for (i = 1; i < nr_pages; i++) {
> 		struct page *p = pfn_to_page(i);
> 		__SetPageTail(p);
> 		p->first_page = page;
> 	}
>
> Oh well, I guess we can go with the obfuscated, uncommented version for
> now :(
>
> This patch applies to 2.6.26 (and possibly earlier) but I don't think
> those kernels can trigger the bug?

I think the problem is that pfn_to_page isn't always trivial. I would
prefer to have seen a new function for hugetlb to use, and keep the
branch-less version for the page allocator itself.

--
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/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2008-10-03  6:43 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-02 16:19 Andy Whitcroft
2008-10-02 21:30 ` Andrew Morton
2008-10-03  6:43   ` Nick Piggin [this message]
2008-10-03 18:11     ` Andy Whitcroft

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=200810031643.28731.nickpiggin@yahoo.com.au \
    --to=nickpiggin@yahoo.com.au \
    --cc=akpm@linux-foundation.org \
    --cc=apw@shadowen.org \
    --cc=kniht@linux.vnet.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mel@csn.ul.ie \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox