aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/mmzone.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/mmzone.h')
-rw-r--r--include/linux/mmzone.h65
1 files changed, 43 insertions, 22 deletions
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index 451eaa13bc28..d5c33a0b89e9 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -393,10 +393,10 @@ static inline int zone_is_oom_locked(const struct zone *zone)
393 * The NUMA zonelists are doubled becausse we need zonelists that restrict the 393 * The NUMA zonelists are doubled becausse we need zonelists that restrict the
394 * allocations to a single node for GFP_THISNODE. 394 * allocations to a single node for GFP_THISNODE.
395 * 395 *
396 * [0 .. MAX_NR_ZONES -1] : Zonelists with fallback 396 * [0] : Zonelist with fallback
397 * [MAZ_NR_ZONES ... MAZ_ZONELISTS -1] : No fallback (GFP_THISNODE) 397 * [1] : No fallback (GFP_THISNODE)
398 */ 398 */
399#define MAX_ZONELISTS (2 * MAX_NR_ZONES) 399#define MAX_ZONELISTS 2
400 400
401 401
402/* 402/*
@@ -464,7 +464,7 @@ struct zonelist_cache {
464 unsigned long last_full_zap; /* when last zap'd (jiffies) */ 464 unsigned long last_full_zap; /* when last zap'd (jiffies) */
465}; 465};
466#else 466#else
467#define MAX_ZONELISTS MAX_NR_ZONES 467#define MAX_ZONELISTS 1
468struct zonelist_cache; 468struct zonelist_cache;
469#endif 469#endif
470 470
@@ -486,24 +486,6 @@ struct zonelist {
486#endif 486#endif
487}; 487};
488 488
489#ifdef CONFIG_NUMA
490/*
491 * Only custom zonelists like MPOL_BIND need to be filtered as part of
492 * policies. As described in the comment for struct zonelist_cache, these
493 * zonelists will not have a zlcache so zlcache_ptr will not be set. Use
494 * that to determine if the zonelists needs to be filtered or not.
495 */
496static inline int alloc_should_filter_zonelist(struct zonelist *zonelist)
497{
498 return !zonelist->zlcache_ptr;
499}
500#else
501static inline int alloc_should_filter_zonelist(struct zonelist *zonelist)
502{
503 return 0;
504}
505#endif /* CONFIG_NUMA */
506
507#ifdef CONFIG_ARCH_POPULATES_NODE_MAP 489#ifdef CONFIG_ARCH_POPULATES_NODE_MAP
508struct node_active_region { 490struct node_active_region {
509 unsigned long start_pfn; 491 unsigned long start_pfn;
@@ -731,6 +713,45 @@ extern struct zone *next_zone(struct zone *zone);
731 zone; \ 713 zone; \
732 zone = next_zone(zone)) 714 zone = next_zone(zone))
733 715
716/* Returns the first zone at or below highest_zoneidx in a zonelist */
717static inline struct zone **first_zones_zonelist(struct zonelist *zonelist,
718 enum zone_type highest_zoneidx)
719{
720 struct zone **z;
721
722 /* Find the first suitable zone to use for the allocation */
723 z = zonelist->zones;
724 while (*z && zone_idx(*z) > highest_zoneidx)
725 z++;
726
727 return z;
728}
729
730/* Returns the next zone at or below highest_zoneidx in a zonelist */
731static inline struct zone **next_zones_zonelist(struct zone **z,
732 enum zone_type highest_zoneidx)
733{
734 /* Find the next suitable zone to use for the allocation */
735 while (*z && zone_idx(*z) > highest_zoneidx)
736 z++;
737
738 return z;
739}
740
741/**
742 * for_each_zone_zonelist - helper macro to iterate over valid zones in a zonelist at or below a given zone index
743 * @zone - The current zone in the iterator
744 * @z - The current pointer within zonelist->zones being iterated
745 * @zlist - The zonelist being iterated
746 * @highidx - The zone index of the highest zone to return
747 *
748 * This iterator iterates though all zones at or below a given zone index.
749 */
750#define for_each_zone_zonelist(zone, z, zlist, highidx) \
751 for (z = first_zones_zonelist(zlist, highidx), zone = *z++; \
752 zone; \
753 z = next_zones_zonelist(z, highidx), zone = *z++)
754
734#ifdef CONFIG_SPARSEMEM 755#ifdef CONFIG_SPARSEMEM
735#include <asm/sparsemem.h> 756#include <asm/sparsemem.h>
736#endif 757#endif