linux/include
Christoph Lameter 4e4785bcf0 [PATCH] mempolicies: fix policy_zone check
There is a check in zonelist_policy that compares pieces of the bitmap
obtained from a gfp mask via GFP_ZONETYPES with a zone number in function
zonelist_policy().

The bitmap is an ORed mask of __GFP_DMA, __GFP_DMA32 and __GFP_HIGHMEM.
The policy_zone is a zone number with the possible values of ZONE_DMA,
ZONE_DMA32, ZONE_HIGHMEM and ZONE_NORMAL. These are two different domains
of values.

For some reason seemed to work before the zone reduction patchset (It
definitely works on SGI boxes since we just have one zone and the check
cannot fail).

With the zone reduction patchset this check definitely fails on systems
with two zones if the system actually has memory in both zones.

This is because ZONE_NORMAL is selected using no __GFP flag at
all and thus gfp_zone(gfpmask) == 0. ZONE_DMA is selected when __GFP_DMA
is set. __GFP_DMA is 0x01.  So gfp_zone(gfpmask) == 1.

policy_zone is set to ZONE_NORMAL (==1) if ZONE_NORMAL and ZONE_DMA are
populated.

For ZONE_NORMAL gfp_zone(<no _GFP_DMA>) yields 0 which is <
policy_zone(ZONE_NORMAL) and so policy is not applied to regular memory
allocations!

Instead gfp_zone(__GFP_DMA) == 1 which results in policy being applied
to DMA allocations!

What we realy want in that place is to establish the highest allowable
zone for a given gfp_mask. If the highest zone is higher or equal to the
policy_zone then memory policies need to be applied. We have such
a highest_zone() function in page_alloc.c.

So move the highest_zone() function from mm/page_alloc.c into
include/linux/gfp.h.  On the way we simplify the function and use the new
zone_type that was also introduced with the zone reduction patchset plus we
also specify the right type for the gfp flags parameter.

Signed-off-by: Christoph Lameter <clameter@sgi.com>
Signed-off-by: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-09-26 08:48:47 -07:00
..
acpi Pull acpi_os_allocate into test branch 2006-07-10 02:39:47 -04:00
asm-alpha [libata] No need for all those arch libata-portmap.h headers 2006-09-25 15:33:09 -04:00
asm-arm Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6 2006-09-24 22:05:59 +01:00
asm-arm26 Remove ARM26 header export. 2006-09-21 08:54:44 +01:00
asm-cris Clean up exported headers on CRIS 2006-09-21 09:33:55 +01:00
asm-frv [libata] No need for all those arch libata-portmap.h headers 2006-09-25 15:33:09 -04:00
asm-generic [PATCH] trigger a syntax error if percpu macros are incorrectly used 2006-09-26 08:48:44 -07:00
asm-h8300 Fix H8300 exported headers. 2006-09-21 08:51:43 +01:00
asm-i386 [PATCH] convert i386 NUMA KVA space to bootmem 2006-09-26 08:48:45 -07:00
asm-ia64 [PATCH] cpu to node relationship fixup: map cpu to node 2006-09-25 17:38:36 -07:00
asm-m32r Fix 'make headers_check' on m32r 2006-09-21 08:41:35 +01:00
asm-m68k [PATCH] Fix 'make headers_check' on ia64 2006-09-19 07:59:59 -07:00
asm-m68knommu Fix m68knommu exported headers 2006-09-21 08:50:36 +01:00
asm-mips [PATCH] headers_check: fix userspace build of asm-mips/page.h 2006-09-13 07:32:16 -07:00
asm-parisc [PATCH] headers_check: Clean up asm-parisc/page.h for user headers 2006-09-19 07:59:59 -07:00
asm-powerpc [libata] No need for all those arch libata-portmap.h headers 2006-09-25 15:33:09 -04:00
asm-ppc [PATCH] #elif that should've been #elif defined 2006-09-23 11:34:43 -07:00
asm-s390 [PATCH] trigger a syntax error if percpu macros are incorrectly used 2006-09-26 08:48:44 -07:00
asm-sh Fix 'make headers_check' on sh 2006-09-21 08:36:50 +01:00
asm-sh64 Fix 'make headers_check' on sh64 2006-09-21 08:37:10 +01:00
asm-sparc [libata] No need for all those arch libata-portmap.h headers 2006-09-25 15:33:09 -04:00
asm-sparc64 [libata] No need for all those arch libata-portmap.h headers 2006-09-25 15:33:09 -04:00
asm-um Remove UML header export 2006-09-21 08:55:28 +01:00
asm-v850 Fix v850 exported headers 2006-09-21 09:05:25 +01:00
asm-x86_64 [PATCH] trigger a syntax error if percpu macros are incorrectly used 2006-09-26 08:48:44 -07:00
asm-xtensa [PATCH] remove set_wmb - arch removal 2006-07-14 21:56:14 -07:00
crypto [CRYPTO] digest: Added user API for new hash type 2006-09-21 11:46:17 +10:00
keys [PATCH] keys: discard the contents of a key on revocation 2006-06-26 09:58:18 -07:00
linux [PATCH] mempolicies: fix policy_zone check 2006-09-26 08:48:47 -07:00
math-emu
media V4L/DVB (4605): Fixes an issue with V4L1 and make headers-install 2006-09-10 13:45:55 -03:00
mtd Merge git://git.infradead.org/~dwmw2/hdroneline 2006-09-22 12:56:22 -07:00
net [NetLabel]: rework the Netlink attribute handling (part 1) 2006-09-25 15:56:09 -07:00
pcmcia
rdma IB/sa: fix ib_sa_selector names 2006-09-22 15:22:55 -07:00
rxrpc
scsi [PATCH] SCSI gfp_t annotations 2006-09-24 20:07:49 -07:00
sound [ALSA] ak4xxx - Remove bogus IPGA controls 2006-09-23 10:46:55 +02:00
video [HEADERS] One line per header in Kbuild files to reduce conflicts 2006-09-19 12:43:58 +01:00
Kbuild [HEADERS] One line per header in Kbuild files to reduce conflicts 2006-09-19 12:43:58 +01:00