diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index 96d4a148648d145ea4c0e17debf62f63e8cf534e..7e1e09fe4e3b65f6f11483ddc14ed22f22b2aeec 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h @@ -968,6 +968,15 @@ static inline int is_highmem_idx(enum zone_type idx) #endif } +#ifdef CONFIG_ZONE_DMA +bool has_managed_dma(void); +#else +static inline bool has_managed_dma(void) +{ + return false; +} +#endif + /** * is_highmem - helper function to quickly check if a struct zone is a * highmem zone or not. This is an attempt to keep references diff --git a/mm/page_alloc.c b/mm/page_alloc.c index a27aed0b99879aaf5c792d902e12299e71f66de3..6185ae68ce4ed1484cb4e7ce648fad36f600c4ba 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -9228,3 +9228,18 @@ enum node_type get_node_type(int nid) return nodes_type[nid]; } #endif + +#ifdef CONFIG_ZONE_DMA +bool has_managed_dma(void) +{ + struct pglist_data *pgdat; + + for_each_online_pgdat(pgdat) { + struct zone *zone = &pgdat->node_zones[ZONE_DMA]; + + if (managed_zone(zone)) + return true; + } + return false; +} +#endif /* CONFIG_ZONE_DMA */