|
@@ -293,11 +293,7 @@ struct zspage {
|
|
|
};
|
|
|
|
|
|
struct mapping_area {
|
|
|
-#ifdef CONFIG_ZSMALLOC_PGTABLE_MAPPING
|
|
|
- struct vm_struct *vm; /* vm area for mapping object that span pages */
|
|
|
-#else
|
|
|
char *vm_buf; /* copy buffer for objects that span pages */
|
|
|
-#endif
|
|
|
char *vm_addr; /* address of kmap_atomic()'ed pages */
|
|
|
enum zs_mapmode vm_mm; /* mapping mode */
|
|
|
};
|
|
@@ -1113,54 +1109,6 @@ static struct zspage *find_get_zspage(struct size_class *class)
|
|
|
return zspage;
|
|
|
}
|
|
|
|
|
|
-#ifdef CONFIG_ZSMALLOC_PGTABLE_MAPPING
|
|
|
-static inline int __zs_cpu_up(struct mapping_area *area)
|
|
|
-{
|
|
|
- /*
|
|
|
- * Make sure we don't leak memory if a cpu UP notification
|
|
|
- * and zs_init() race and both call zs_cpu_up() on the same cpu
|
|
|
- */
|
|
|
- if (area->vm)
|
|
|
- return 0;
|
|
|
- area->vm = get_vm_area(PAGE_SIZE * 2, 0);
|
|
|
- if (!area->vm)
|
|
|
- return -ENOMEM;
|
|
|
-
|
|
|
- /*
|
|
|
- * Populate ptes in advance to avoid pte allocation with GFP_KERNEL
|
|
|
- * in non-preemtible context of zs_map_object.
|
|
|
- */
|
|
|
- return apply_to_page_range(&init_mm, (unsigned long)area->vm->addr,
|
|
|
- PAGE_SIZE * 2, NULL, NULL);
|
|
|
-}
|
|
|
-
|
|
|
-static inline void __zs_cpu_down(struct mapping_area *area)
|
|
|
-{
|
|
|
- if (area->vm)
|
|
|
- free_vm_area(area->vm);
|
|
|
- area->vm = NULL;
|
|
|
-}
|
|
|
-
|
|
|
-static inline void *__zs_map_object(struct mapping_area *area,
|
|
|
- struct page *pages[2], int off, int size)
|
|
|
-{
|
|
|
- unsigned long addr = (unsigned long)area->vm->addr;
|
|
|
-
|
|
|
- BUG_ON(map_kernel_range(addr, PAGE_SIZE * 2, PAGE_KERNEL, pages) < 0);
|
|
|
- area->vm_addr = area->vm->addr;
|
|
|
- return area->vm_addr + off;
|
|
|
-}
|
|
|
-
|
|
|
-static inline void __zs_unmap_object(struct mapping_area *area,
|
|
|
- struct page *pages[2], int off, int size)
|
|
|
-{
|
|
|
- unsigned long addr = (unsigned long)area->vm_addr;
|
|
|
-
|
|
|
- unmap_kernel_range(addr, PAGE_SIZE * 2);
|
|
|
-}
|
|
|
-
|
|
|
-#else /* CONFIG_ZSMALLOC_PGTABLE_MAPPING */
|
|
|
-
|
|
|
static inline int __zs_cpu_up(struct mapping_area *area)
|
|
|
{
|
|
|
/*
|
|
@@ -1241,8 +1189,6 @@ out:
|
|
|
pagefault_enable();
|
|
|
}
|
|
|
|
|
|
-#endif /* CONFIG_ZSMALLOC_PGTABLE_MAPPING */
|
|
|
-
|
|
|
static int zs_cpu_prepare(unsigned int cpu)
|
|
|
{
|
|
|
struct mapping_area *area;
|