summaryrefslogtreecommitdiffstats
path: root/include/linux/mmzone.h
diff options
context:
space:
mode:
authorDan Williams <dan.j.williams@intel.com>2015-08-09 15:29:06 -0400
committerDan Williams <dan.j.williams@intel.com>2015-08-27 19:40:58 -0400
commit033fbae988fcb67e5077203512181890848b8e90 (patch)
treed0b9e418ab4f1df15435c098edf5ad687b426b3f /include/linux/mmzone.h
parent012dcef3f058385268630c0003e9b7f8dcafbeb4 (diff)
mm: ZONE_DEVICE for "device memory"
While pmem is usable as a block device or via DAX mappings to userspace there are several usage scenarios that can not target pmem due to its lack of struct page coverage. In preparation for "hot plugging" pmem into the vmemmap add ZONE_DEVICE as a new zone to tag these pages separately from the ones that are subject to standard page allocations. Importantly "device memory" can be removed at will by userspace unbinding the driver of the device. Having a separate zone prevents allocation and otherwise marks these pages that are distinct from typical uniform memory. Device memory has different lifetime and performance characteristics than RAM. However, since we have run out of ZONES_SHIFT bits this functionality currently depends on sacrificing ZONE_DMA. Cc: H. Peter Anvin <hpa@zytor.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: Dave Hansen <dave.hansen@linux.intel.com> Cc: Rik van Riel <riel@redhat.com> Cc: Mel Gorman <mgorman@suse.de> Cc: Jerome Glisse <j.glisse@gmail.com> [hch: various simplifications in the arch interface] Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'include/linux/mmzone.h')
-rw-r--r--include/linux/mmzone.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index 754c25966a0a..9217fd93c25b 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -319,7 +319,11 @@ enum zone_type {
319 ZONE_HIGHMEM, 319 ZONE_HIGHMEM,
320#endif 320#endif
321 ZONE_MOVABLE, 321 ZONE_MOVABLE,
322#ifdef CONFIG_ZONE_DEVICE
323 ZONE_DEVICE,
324#endif
322 __MAX_NR_ZONES 325 __MAX_NR_ZONES
326
323}; 327};
324 328
325#ifndef __GENERATING_BOUNDS_H 329#ifndef __GENERATING_BOUNDS_H
@@ -794,6 +798,25 @@ static inline bool pgdat_is_empty(pg_data_t *pgdat)
794 return !pgdat->node_start_pfn && !pgdat->node_spanned_pages; 798 return !pgdat->node_start_pfn && !pgdat->node_spanned_pages;
795} 799}
796 800
801static inline int zone_id(const struct zone *zone)
802{
803 struct pglist_data *pgdat = zone->zone_pgdat;
804
805 return zone - pgdat->node_zones;
806}
807
808#ifdef CONFIG_ZONE_DEVICE
809static inline bool is_dev_zone(const struct zone *zone)
810{
811 return zone_id(zone) == ZONE_DEVICE;
812}
813#else
814static inline bool is_dev_zone(const struct zone *zone)
815{
816 return false;
817}
818#endif
819
797#include <linux/memory_hotplug.h> 820#include <linux/memory_hotplug.h>
798 821
799extern struct mutex zonelists_mutex; 822extern struct mutex zonelists_mutex;