Revert "mm: Update is_vmalloc_addr to account for vmalloc savings"

This reverts commit d6f731ef20.

Signed-off-by: UtsavBalar1231 <utsavbalar1231@gmail.com>
Change-Id: Ie45c436f0d2fdce0105ab201e0f6415b4144e037
This commit is contained in:
UtsavBalar1231 2022-04-26 21:06:34 +05:30 committed by spakkkk
parent 32d60364c4
commit 151d2098e9
4 changed files with 8 additions and 75 deletions

View File

@ -1544,7 +1544,6 @@ static void __init map_lowmem(void)
vm->flags |= VM_ARM_MTYPE(type);
vm->caller = map_lowmem;
add_static_vm_early(svm++);
mark_vmalloc_reserved_area(vm->addr, vm->size);
}
}

View File

@ -591,16 +591,16 @@ unsigned long vmalloc_to_pfn(const void *addr);
* On nommu, vmalloc/vfree wrap through kmalloc/kfree directly, so there
* is no special casing required.
*/
#ifdef CONFIG_MMU
extern int is_vmalloc_addr(const void *x);
#else
static inline int is_vmalloc_addr(const void *x)
static inline bool is_vmalloc_addr(const void *x)
{
return 0;
}
#endif
#ifdef CONFIG_MMU
unsigned long addr = (unsigned long)x;
return addr >= VMALLOC_START && addr < VMALLOC_END;
#else
return false;
#endif
}
#ifdef CONFIG_MMU
extern int is_vmalloc_or_module_addr(const void *x);
#else

View File

@ -183,12 +183,6 @@ extern struct list_head vmap_area_list;
extern __init void vm_area_add_early(struct vm_struct *vm);
extern __init void vm_area_register_early(struct vm_struct *vm, size_t align);
extern __init int vm_area_check_early(struct vm_struct *vm);
#ifdef CONFIG_ENABLE_VMALLOC_SAVING
extern void mark_vmalloc_reserved_area(void *addr, unsigned long size);
#else
static inline void mark_vmalloc_reserved_area(void *addr, unsigned long size)
{ };
#endif
#ifdef CONFIG_SMP
# ifdef CONFIG_MMU
@ -214,12 +208,7 @@ pcpu_free_vm_areas(struct vm_struct **vms, int nr_vms)
#endif
#ifdef CONFIG_MMU
#ifdef CONFIG_ENABLE_VMALLOC_SAVING
extern unsigned long total_vmalloc_size;
#define VMALLOC_TOTAL total_vmalloc_size
#else
#define VMALLOC_TOTAL (VMALLOC_END - VMALLOC_START)
#endif
#else
#define VMALLOC_TOTAL 0UL
#endif

View File

@ -405,57 +405,6 @@ unsigned long vmalloc_nr_pages(void)
return atomic_long_read(&nr_vmalloc_pages);
}
#ifdef CONFIG_ENABLE_VMALLOC_SAVING
#define POSSIBLE_VMALLOC_START PAGE_OFFSET
#define VMALLOC_BITMAP_SIZE ((VMALLOC_END - PAGE_OFFSET) >> \
PAGE_SHIFT)
#define VMALLOC_TO_BIT(addr) ((addr - PAGE_OFFSET) >> PAGE_SHIFT)
#define BIT_TO_VMALLOC(i) (PAGE_OFFSET + i * PAGE_SIZE)
unsigned long total_vmalloc_size;
unsigned long vmalloc_reserved;
DECLARE_BITMAP(possible_areas, VMALLOC_BITMAP_SIZE);
void mark_vmalloc_reserved_area(void *x, unsigned long size)
{
unsigned long addr = (unsigned long)x;
bitmap_set(possible_areas, VMALLOC_TO_BIT(addr), size >> PAGE_SHIFT);
vmalloc_reserved += size;
}
int is_vmalloc_addr(const void *x)
{
unsigned long addr = (unsigned long)x;
if (addr < POSSIBLE_VMALLOC_START || addr >= VMALLOC_END)
return 0;
if (test_bit(VMALLOC_TO_BIT(addr), possible_areas))
return 0;
return 1;
}
static void calc_total_vmalloc_size(void)
{
total_vmalloc_size = VMALLOC_END - POSSIBLE_VMALLOC_START -
vmalloc_reserved;
}
#else
int is_vmalloc_addr(const void *x)
{
unsigned long addr = (unsigned long)x;
return addr >= VMALLOC_START && addr < VMALLOC_END;
}
static void calc_total_vmalloc_size(void) { }
#endif
EXPORT_SYMBOL(is_vmalloc_addr);
static atomic_long_t nr_vmalloc_pages;
static struct vmap_area *__find_vmap_area(unsigned long addr)
@ -1957,7 +1906,6 @@ void __init vmalloc_init(void)
* Now we can initialize a free vmap space.
*/
vmap_init_free_space();
calc_total_vmalloc_size();
vmap_initialized = true;
}
@ -3466,9 +3414,6 @@ static int s_show(struct seq_file *m, void *p)
if (is_vmalloc_addr(v->pages))
seq_puts(m, " vpages");
if (v->flags & VM_LOWMEM)
seq_puts(m, " lowmem");
show_numa_info(m, v);
seq_putc(m, '\n');
return 0;