+ optional-zone_dma-in-the-vm-tidy.patch added to -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled

     count defined zones to size ZONE_SHIFT

has been added to the -mm tree.  Its filename is

     optional-zone_dma-in-the-vm-tidy.patch

See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find
out what to do about this

------------------------------------------------------
Subject: count defined zones to size ZONE_SHIFT
From: Andy Whitcroft <apw@xxxxxxxxxxxx>

Simplify calculation of the number of bits we need for ZONES_SHIFT by
adding up the definitions of the defined zones.  We make use of the
property of defined(X) that its value is one when X is defined and zero
otherwise.  From the GCC manuals:

  "defined name and defined (name) are both expressions whose
   value is 1 if name is defined as a macro at the current point
   in the program, and 0 otherwise."

Signed-off-by: Andy Whitcroft <apw@xxxxxxxxxxxx>
Cc: Christoph Lameter <clameter@xxxxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxx>
---

 include/linux/mmzone.h |   22 +++++++++++++++++-----
 1 files changed, 17 insertions(+), 5 deletions(-)

diff -puN include/linux/mmzone.h~optional-zone_dma-in-the-vm-tidy include/linux/mmzone.h
--- a/include/linux/mmzone.h~optional-zone_dma-in-the-vm-tidy
+++ a/include/linux/mmzone.h
@@ -149,15 +149,27 @@ enum zone_type {
  * match the requested limits. See gfp_zone() in include/linux/gfp.h
  */
 
-#if !defined(CONFIG_ZONE_DMA32) && !defined(CONFIG_HIGHMEM)
-#if !defined(CONFIG_ZONE_DMA)
+/*
+ * Count the active zones.  Note that the use of defined(X) outside
+ * #if and family is not necessarily defined so ensure we cannot use
+ * it later.  Use __ZONE_COUNT to work out how many shift bits we need.
+ */
+#define __ZONE_COUNT (			\
+	  defined(CONFIG_ZONE_DMA)	\
+	+ defined(CONFIG_ZONE_DMA32)	\
+	+ 1				\
+	+ defined(CONFIG_HIGHMEM)	\
+)
+#if __ZONE_COUNT < 2
 #define ZONES_SHIFT 0
-#else
+#elif __ZONE_COUNT <= 2
 #define ZONES_SHIFT 1
-#endif
-#else
+#elif __ZONE_COUNT <= 4
 #define ZONES_SHIFT 2
+#else
+#error ZONES_SHIFT -- too many zones configured adjust calculation
 #endif
+#undef __ZONE_COUNT
 
 struct zone {
 	/* Fields commonly accessed by the page allocator */
_

Patches currently in -mm which might be from apw@xxxxxxxxxxxx are

bodge-scsi-misc-module-reference-count-checks-with-no-module_unload.patch
add-__gfp_thisnode-to-avoid-fallback-to-other-nodes-and-ignore.patch
add-__gfp_thisnode-to-avoid-fallback-to-other-nodes-and-ignore-fix.patch
sys_move_pages-do-not-fall-back-to-other-nodes.patch
guarantee-that-the-uncached-allocator-gets-pages-on-the-correct.patch
introduce-mechanism-for-registering-active-regions-of-memory.patch
have-power-use-add_active_range-and-free_area_init_nodes.patch
have-x86-use-add_active_range-and-free_area_init_nodes.patch
have-x86-use-add_active_range-and-free_area_init_nodes-fix.patch
have-x86_64-use-add_active_range-and-free_area_init_nodes.patch
have-ia64-use-add_active_range-and-free_area_init_nodes.patch
account-for-memmap-and-optionally-the-kernel-image-as-holes.patch
account-for-holes-that-are-outside-the-range-of-physical-memory.patch
allow-an-arch-to-expand-node-boundaries.patch
get-rid-of-zone_table.patch
get-rid-of-zone_table-fix.patch
optional-zone_dma-in-the-vm-tidy.patch
avr32-kill-config_discontigmem-support-completely.patch

-
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Kernel Newbies FAQ]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Photo]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux