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.h57
1 files changed, 32 insertions, 25 deletions
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index 32699b2dc52a..1e22d96734e0 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -755,25 +755,6 @@ static inline bool pgdat_is_empty(pg_data_t *pgdat)
755 return !pgdat->node_start_pfn && !pgdat->node_spanned_pages; 755 return !pgdat->node_start_pfn && !pgdat->node_spanned_pages;
756} 756}
757 757
758static inline int zone_id(const struct zone *zone)
759{
760 struct pglist_data *pgdat = zone->zone_pgdat;
761
762 return zone - pgdat->node_zones;
763}
764
765#ifdef CONFIG_ZONE_DEVICE
766static inline bool is_dev_zone(const struct zone *zone)
767{
768 return zone_id(zone) == ZONE_DEVICE;
769}
770#else
771static inline bool is_dev_zone(const struct zone *zone)
772{
773 return false;
774}
775#endif
776
777#include <linux/memory_hotplug.h> 758#include <linux/memory_hotplug.h>
778 759
779void build_all_zonelists(pg_data_t *pgdat); 760void build_all_zonelists(pg_data_t *pgdat);
@@ -824,6 +805,18 @@ static inline int local_memory_node(int node_id) { return node_id; };
824 */ 805 */
825#define zone_idx(zone) ((zone) - (zone)->zone_pgdat->node_zones) 806#define zone_idx(zone) ((zone) - (zone)->zone_pgdat->node_zones)
826 807
808#ifdef CONFIG_ZONE_DEVICE
809static inline bool is_dev_zone(const struct zone *zone)
810{
811 return zone_idx(zone) == ZONE_DEVICE;
812}
813#else
814static inline bool is_dev_zone(const struct zone *zone)
815{
816 return false;
817}
818#endif
819
827/* 820/*
828 * Returns true if a zone has pages managed by the buddy allocator. 821 * Returns true if a zone has pages managed by the buddy allocator.
829 * All the reclaim decisions have to use this function rather than 822 * All the reclaim decisions have to use this function rather than
@@ -841,6 +834,25 @@ static inline bool populated_zone(struct zone *zone)
841 return zone->present_pages; 834 return zone->present_pages;
842} 835}
843 836
837#ifdef CONFIG_NUMA
838static inline int zone_to_nid(struct zone *zone)
839{
840 return zone->node;
841}
842
843static inline void zone_set_nid(struct zone *zone, int nid)
844{
845 zone->node = nid;
846}
847#else
848static inline int zone_to_nid(struct zone *zone)
849{
850 return 0;
851}
852
853static inline void zone_set_nid(struct zone *zone, int nid) {}
854#endif
855
844extern int movable_zone; 856extern int movable_zone;
845 857
846#ifdef CONFIG_HIGHMEM 858#ifdef CONFIG_HIGHMEM
@@ -956,12 +968,7 @@ static inline int zonelist_zone_idx(struct zoneref *zoneref)
956 968
957static inline int zonelist_node_idx(struct zoneref *zoneref) 969static inline int zonelist_node_idx(struct zoneref *zoneref)
958{ 970{
959#ifdef CONFIG_NUMA 971 return zone_to_nid(zoneref->zone);
960 /* zone_to_nid not available in this context */
961 return zoneref->zone->node;
962#else
963 return 0;
964#endif /* CONFIG_NUMA */
965} 972}
966 973
967struct zoneref *__next_zones_zonelist(struct zoneref *z, 974struct zoneref *__next_zones_zonelist(struct zoneref *z,