Skip to content

Commit c3f896d

Browse files
Christoph Hellwigtorvalds
authored andcommitted
mm: switch the test_vmalloc module to use __vmalloc_node
No need to export the very low-level __vmalloc_node_range when the test module can use a slightly higher level variant. [[email protected]: add missing `node' arg] [[email protected]: fix riscv nommu build] Signed-off-by: Christoph Hellwig <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Acked-by: Peter Zijlstra (Intel) <[email protected]> Cc: Christian Borntraeger <[email protected]> Cc: Christophe Leroy <[email protected]> Cc: Daniel Vetter <[email protected]> Cc: David Airlie <[email protected]> Cc: Gao Xiang <[email protected]> Cc: Greg Kroah-Hartman <[email protected]> Cc: Haiyang Zhang <[email protected]> Cc: Johannes Weiner <[email protected]> Cc: "K. Y. Srinivasan" <[email protected]> Cc: Laura Abbott <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Michael Kelley <[email protected]> Cc: Minchan Kim <[email protected]> Cc: Nitin Gupta <[email protected]> Cc: Robin Murphy <[email protected]> Cc: Sakari Ailus <[email protected]> Cc: Stephen Hemminger <[email protected]> Cc: Sumit Semwal <[email protected]> Cc: Wei Liu <[email protected]> Cc: Benjamin Herrenschmidt <[email protected]> Cc: Catalin Marinas <[email protected]> Cc: Heiko Carstens <[email protected]> Cc: Paul Mackerras <[email protected]> Cc: Vasily Gorbik <[email protected]> Cc: Will Deacon <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Linus Torvalds <[email protected]>
1 parent 2b90594 commit c3f896d

File tree

3 files changed

+17
-30
lines changed

3 files changed

+17
-30
lines changed

arch/riscv/include/asm/pgtable.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -473,9 +473,9 @@ static inline int ptep_clear_flush_young(struct vm_area_struct *vma,
473473
#define PAGE_SHARED __pgprot(0)
474474
#define PAGE_KERNEL __pgprot(0)
475475
#define swapper_pg_dir NULL
476+
#define TASK_SIZE 0xffffffffUL
476477
#define VMALLOC_START 0
477-
478-
#define TASK_SIZE 0xffffffffUL
478+
#define VMALLOC_END TASK_SIZE
479479

480480
static inline void __kernel_map_pages(struct page *page, int numpages, int enable) {}
481481

lib/test_vmalloc.c

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -91,12 +91,8 @@ static int random_size_align_alloc_test(void)
9191
*/
9292
size = ((rnd % 10) + 1) * PAGE_SIZE;
9393

94-
ptr = __vmalloc_node_range(size, align,
95-
VMALLOC_START, VMALLOC_END,
96-
GFP_KERNEL | __GFP_ZERO,
97-
PAGE_KERNEL,
98-
0, 0, __builtin_return_address(0));
99-
94+
ptr = __vmalloc_node(size, align, GFP_KERNEL | __GFP_ZERO, 0,
95+
__builtin_return_address(0));
10096
if (!ptr)
10197
return -1;
10298

@@ -118,12 +114,8 @@ static int align_shift_alloc_test(void)
118114
for (i = 0; i < BITS_PER_LONG; i++) {
119115
align = ((unsigned long) 1) << i;
120116

121-
ptr = __vmalloc_node_range(PAGE_SIZE, align,
122-
VMALLOC_START, VMALLOC_END,
123-
GFP_KERNEL | __GFP_ZERO,
124-
PAGE_KERNEL,
125-
0, 0, __builtin_return_address(0));
126-
117+
ptr = __vmalloc_node(PAGE_SIZE, align, GFP_KERNEL|__GFP_ZERO, 0,
118+
__builtin_return_address(0));
127119
if (!ptr)
128120
return -1;
129121

@@ -139,13 +131,9 @@ static int fix_align_alloc_test(void)
139131
int i;
140132

141133
for (i = 0; i < test_loop_count; i++) {
142-
ptr = __vmalloc_node_range(5 * PAGE_SIZE,
143-
THREAD_ALIGN << 1,
144-
VMALLOC_START, VMALLOC_END,
145-
GFP_KERNEL | __GFP_ZERO,
146-
PAGE_KERNEL,
147-
0, 0, __builtin_return_address(0));
148-
134+
ptr = __vmalloc_node(5 * PAGE_SIZE, THREAD_ALIGN << 1,
135+
GFP_KERNEL | __GFP_ZERO, 0,
136+
__builtin_return_address(0));
149137
if (!ptr)
150138
return -1;
151139

mm/vmalloc.c

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2523,15 +2523,6 @@ void *__vmalloc_node_range(unsigned long size, unsigned long align,
25232523
return NULL;
25242524
}
25252525

2526-
/*
2527-
* This is only for performance analysis of vmalloc and stress purpose.
2528-
* It is required by vmalloc test module, therefore do not use it other
2529-
* than that.
2530-
*/
2531-
#ifdef CONFIG_TEST_VMALLOC_MODULE
2532-
EXPORT_SYMBOL_GPL(__vmalloc_node_range);
2533-
#endif
2534-
25352526
/**
25362527
* __vmalloc_node - allocate virtually contiguous memory
25372528
* @size: allocation size
@@ -2557,6 +2548,14 @@ void *__vmalloc_node(unsigned long size, unsigned long align,
25572548
return __vmalloc_node_range(size, align, VMALLOC_START, VMALLOC_END,
25582549
gfp_mask, PAGE_KERNEL, 0, node, caller);
25592550
}
2551+
/*
2552+
* This is only for performance analysis of vmalloc and stress purpose.
2553+
* It is required by vmalloc test module, therefore do not use it other
2554+
* than that.
2555+
*/
2556+
#ifdef CONFIG_TEST_VMALLOC_MODULE
2557+
EXPORT_SYMBOL_GPL(__vmalloc_node);
2558+
#endif
25602559

25612560
void *__vmalloc(unsigned long size, gfp_t gfp_mask)
25622561
{

0 commit comments

Comments
 (0)