linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Mel Gorman <mel@csn.ul.ie>
To: Christoph Lameter <cl@linux-foundation.org>
Cc: akpm@linux-foundation.org, linux-mm@kvack.org, npiggin@suse.de,
	KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Subject: Re: [PATCH] Use integer fields lookup for gfp_zone and check for errors in flags passed to the page allocator
Date: Mon, 25 May 2009 12:30:05 +0100	[thread overview]
Message-ID: <20090525113004.GD12160@csn.ul.ie> (raw)
In-Reply-To: <alpine.DEB.1.10.0905221438120.5515@qirst.com>

On Fri, May 22, 2009 at 02:42:32PM -0400, Christoph Lameter wrote:
> 
> Subject: Use integer fields lookup for gfp_zone and check for errors in flags passed to the page allocator
> 
> This simplifies the code in gfp_zone() and also keeps the ability of the
> compiler to use constant folding to get rid of gfp_zone processing.
> 
> The lookup of the zone is done using a bitfield stored in an integer. So
> the code in gfp_zone is a simple extraction of bits from a constant bitfield.
> The compiler is generating a load of a constant into a register and then
> performs a shift and mask operation to get the zone from a gfp_t.
> 
> No cachelines are touched and no branches have to be predicted by the
> compiler.
> 
> We are doing some macro tricks here to convince the compiler to always do the
> constant folding if possible.
> 
> Tested on:
> i386 (kvm), x86_64(native)
> 

How was this tested? This patch boots on x86 for example, but when I
patched further to validate that gfp_zone() returned sensible values, I got
mismatches for GFP_HIGHUSER. These were the results I got for common GFP
flags on three architectures

x86
[    0.000000] mminit::gfp_zone GFP_DMA              PASS
[    0.000000] mminit::gfp_zone GFP_DMA32            FAIL 1 != 0
[    0.000000] mminit::gfp_zone GFP_NOIO             PASS
[    0.000000] mminit::gfp_zone GFP_NOFS             PASS
[    0.000000] mminit::gfp_zone GFP_KERNEL           PASS
[    0.000000] mminit::gfp_zone GFP_TEMPORARY        PASS
[    0.000000] mminit::gfp_zone GFP_USER             PASS
[    0.000000] mminit::gfp_zone GFP_HIGHUSER         FAIL 2 != 1
[    0.000000] mminit::gfp_zone GFP_HIGHUSER_MOVABLE PASS

I expect that the machine would start running into reclaim issues with
enough uptime because it'll not be using Highmem as it should. Similarly,
the GFP_DMA32 may also be a problem as the new implementation is going
ZONE_DMA when ZONE_NORMAL would have been ok in this case.

x86-64
[    0.000000] mminit::gfp_zone GFP_DMA              PASS
[    0.000000] mminit::gfp_zone GFP_DMA32            PASS
[    0.000000] mminit::gfp_zone GFP_NOIO             PASS
[    0.000000] mminit::gfp_zone GFP_NOFS             PASS
[    0.000000] mminit::gfp_zone GFP_KERNEL           PASS
[    0.000000] mminit::gfp_zone GFP_TEMPORARY        PASS
[    0.000000] mminit::gfp_zone GFP_USER             PASS
[    0.000000] mminit::gfp_zone GFP_HIGHUSER         PASS
[    0.000000] mminit::gfp_zone GFP_HIGHUSER_MOVABLE PASS

Happy days on x86-64.

ppc64
[    0.000000] mminit::gfp_zone GFP_DMA              PASS
[    0.000000] mminit::gfp_zone GFP_DMA32            FAIL 1 != 0
[    0.000000] mminit::gfp_zone GFP_NOIO             PASS
[    0.000000] mminit::gfp_zone GFP_NOFS             PASS
[    0.000000] mminit::gfp_zone GFP_KERNEL           PASS
[    0.000000] mminit::gfp_zone GFP_TEMPORARY        PASS
[    0.000000] mminit::gfp_zone GFP_USER             PASS
[    0.000000] mminit::gfp_zone GFP_HIGHUSER         PASS
[    0.000000] mminit::gfp_zone GFP_HIGHUSER_MOVABLE PASS

This mismatch on GFP_DMA32 is similar to x86. However, on ppc64 this error
is harmless as ZONE_NORMAL is never populated anyway so GFP_DMA32 going to
ZONE_DMA is just fine.

This is similar difficulty that earlier versions of the patch ran into although
this version is much closer to being correct. I'll look again tomorrow to
see can it be repaired. In the meantime, here is the patch I used to validate
your gfp_zone() implementation and maybe you'll spot the problem faster.

==== CUT HERE ====

  parent reply	other threads:[~2009-05-25 11:29 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-22 18:42 Christoph Lameter
2009-05-25  1:51 ` KAMEZAWA Hiroyuki
2009-05-26 16:58   ` Christoph Lameter
2009-05-25 11:30 ` Mel Gorman [this message]
2009-05-26 18:04   ` Christoph Lameter
2009-05-26 23:26     ` Mel Gorman
2009-05-27  9:48       ` Mel Gorman
2009-05-27 14:23         ` Christoph Lameter

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=20090525113004.GD12160@csn.ul.ie \
    --to=mel@csn.ul.ie \
    --cc=akpm@linux-foundation.org \
    --cc=cl@linux-foundation.org \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=linux-mm@kvack.org \
    --cc=npiggin@suse.de \
    /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