From c652e8d303af087269b93eac7c4bf52626818f7f Mon Sep 17 00:00:00 2001 From: Namhoon Kim Date: Mon, 5 Jun 2017 14:28:28 -0400 Subject: Added vmalloc_color() --- include/linux/vmalloc.h | 1 + mm/page_alloc.c | 3 --- mm/vmalloc.c | 16 ++++++++++++++++ 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h index 0ec598381f97..c82054890d77 100644 --- a/include/linux/vmalloc.h +++ b/include/linux/vmalloc.h @@ -67,6 +67,7 @@ static inline void vmalloc_init(void) #endif extern void *vmalloc(unsigned long size); +extern void *vmalloc_color(unsigned long size); extern void *vzalloc(unsigned long size); extern void *vmalloc_user(unsigned long size); extern void *vmalloc_node(unsigned long size, int node); diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 45cce6a34295..4611656df49a 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -1183,9 +1183,6 @@ struct page *__rmqueue_smallest(struct zone *zone, unsigned int order, if (order == 0 && color_req == 1) { int found = 0; - /* Colored page request with order = 0 */ - if (is_realtime(current)) - printk(KERN_INFO "COLORED PAGE IS REQUESTED on CPU%d\n", cpu); /* Find a page of the appropriate size in the preferred list */ for (current_order = order; current_order < MAX_PARTITIONED_ORDER; ++current_order) { area = &(zone->free_area_d[cpu][current_order]); diff --git a/mm/vmalloc.c b/mm/vmalloc.c index 2faaa2976447..27600f419126 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c @@ -1745,6 +1745,22 @@ void *vmalloc(unsigned long size) } EXPORT_SYMBOL(vmalloc); +/** + * vmalloc_color - allocate virtually contiguous memory from a dedicated free_area + * @size: allocation size + * Allocate enough pages to cover @size from the page level + * allocator and map them into contiguous kernel virtual space. + * + * For tight control over page level allocator and protection flags + * use __vmalloc() instead. + */ +void *vmalloc_color(unsigned long size) +{ + return __vmalloc_node_flags(size, NUMA_NO_NODE, + GFP_KERNEL | __GFP_HIGHMEM | GFP_COLOR); +} +EXPORT_SYMBOL(vmalloc_color); + /** * vzalloc - allocate virtually contiguous memory with zero fill * @size: allocation size -- cgit v1.2.2