mm/vmalloc: Extend find_vmap_lowest_match_check with extra arguments
Subsystems (2)
PATCH v2 1/1 mm/vmalloc: Extend find_vmap_lowest_match_check with extra arguments
find_vmap_lowest_match() is now able to handle different roots. With DEBUG_AUGMENT_LOWEST_MATCH_CHECK enabled as:
mm/vmalloc.c +0 -0
@@ -713,7 +713,7 @@ EXPORT_SYMBOL(vmalloc_to_pfn);
/*** Global kva allocator ***/
-#define DEBUG_AUGMENT_LOWEST_MATCH_CHECK 0
+#define DEBUG_AUGMENT_LOWEST_MATCH_CHECK 1
compilation failed as:
mm/vmalloc.c: In function 'find_vmap_lowest_match_check':mm/vmalloc.c:1328:32: warning: passing argument 1 of 'find_vmap_lowest_match' makes pointer from integer without a cast [-Wint-conversion]
1328 | va_1 = find_vmap_lowest_match(size, align, vstart, false);
| ^~~~
| |
| long unsigned int
mm/vmalloc.c:1236:40: note: expected 'struct rb_root *' but argument is of type 'long unsigned int'
1236 | find_vmap_lowest_match(struct rb_root *root, unsigned long size,
| ~~~~~~~~~~~~~~~~^~~~
mm/vmalloc.c:1328:9: error: too few arguments to function 'find_vmap_lowest_match'
1328 | va_1 = find_vmap_lowest_match(size, align, vstart, false);
| ^~~~~~~~~~~~~~~~~~~~~~
mm/vmalloc.c:1236:1: note: declared here
1236 | find_vmap_lowest_match(struct rb_root *root, unsigned long size,
| ^~~~~~~~~~~~~~~~~~~~~~Extend find_vmap_lowest_match_check() and find_vmap_lowest_linear_match() with extra arguments to fix this.
---
Changes v1 => v2:
1. Update commit log to show the error with DEBUG_AUGMENT_LOWEST_MATCH_CHECK. (Uladzislau Rezki, Baoquan He)
--- mm/vmalloc.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
mm/vmalloc.c +7 -6
@@ -1300,12 +1300,12 @@ find_vmap_lowest_match(struct rb_root *root, unsigned long size,#include <linux/random.h> static struct vmap_area * -find_vmap_lowest_linear_match (unsigned long size, +find_vmap_lowest_linear_match (struct list_head *head,unsigned long size,unsigned long align,unsigned long vstart) {struct vmap_area *va; -list_for_each_entry (va, &free_vmap_area_list, list) { +list_for_each_entry (va, head, list) {if (!is_within_this_va (va, size, align, vstart))continue ;
@@ -1316,7 +1316,8 @@ find_vmap_lowest_linear_match(unsigned long size, }static void -find_vmap_lowest_match_check (unsigned long size,unsigned long align) +find_vmap_lowest_match_check (struct rb_root *root,struct list_head *head, +unsigned long size,unsigned long align) {struct vmap_area *va_1, *va_2;unsigned long vstart;
@@ -1325,8 +1326,8 @@ find_vmap_lowest_match_check(unsigned long size, unsigned long align)get_random_bytes (&rnd,sizeof (rnd)); vstart =VMALLOC_START + rnd; - va_1 =find_vmap_lowest_match (size, align, vstart, false); - va_2 =find_vmap_lowest_linear_match (size, align, vstart); + va_1 =find_vmap_lowest_match (root, size, align, vstart, false); + va_2 =find_vmap_lowest_linear_match (head, size, align, vstart);if (va_1 != va_2) pr_emerg("not lowest: t: 0x%p, l: 0x%p, v: 0x%lx\n",
@@ -1513,7 +1514,7 @@ __alloc_vmap_area(struct rb_root *root, struct list_head *head,return vend;#if DEBUG_AUGMENT_LOWEST_MATCH_CHECK -find_vmap_lowest_match_check (size, align); +find_vmap_lowest_match_check (root, head, size, align);#endif return nva_start_addr;
Signature · 1 line
2.30.2
Quoted 35 lines · Song Liu
find_vmap_lowest_match()is now able to handle different roots. WithDEBUG_AUGMENT_LOWEST_MATCH_CHECKenabled as:mm/vmalloc.c +1
-1@@ -713,7 +713,7 @@ EXPORT_SYMBOL(vmalloc_to_pfn);/*** Global kva allocator ***/ -#define DEBUG_AUGMENT_LOWEST_MATCH_CHECK 0 +#define DEBUG_AUGMENT_LOWEST_MATCH_CHECK 1compilation failed as:
mm/vmalloc.c: In function 'find_vmap_lowest_match_check':mm/vmalloc.c:1328:32: warning: passing argument 1 of 'find_vmap_lowest_match' makes pointer from integer without a cast [-Wint-conversion] 1328 |va_1=find_vmap_lowest_match(size, align, vstart, false);| ^~~~ | | | long unsigned int mm/vmalloc.c:1236:40: note: expected 'struct rb_root *' but argument is of type 'long unsigned int' 1236 | find_vmap_lowest_match(struct rb_root *root, unsigned long size, | ~~~~~~~~~~~~~~~~^~~~ mm/vmalloc.c:1328:9: error: too few arguments to function 'find_vmap_lowest_match' 1328 | va_1 = find_vmap_lowest_match(size, align, vstart, false); | ^~~~~~~~~~~~~~~~~~~~~~ mm/vmalloc.c:1236:1: note: declared here 1236 | find_vmap_lowest_match(struct rb_root *root, unsigned long size, | ^~~~~~~~~~~~~~~~~~~~~~
Quoted 8 lines
Extend
find_vmap_lowest_match_check()andfind_vmap_lowest_linear_match()with extra arguments to fix this.Fixes f9863be49312 ("mm/vmalloc: extend __alloc_vmap_area() with extra arguments")Cc Uladzislau Rezki (Sony) <[email protected]>Cc Baoquan He <[email protected]>Cc Andrew Morton <[email protected]>Signed-off-by Song Liu <[email protected]>
Forgot to add the following from v1:
Quoted 61 lines
---
Changes v1 => v2:
1. Update commit log to show the error withDEBUG_AUGMENT_LOWEST_MATCH_CHECK. (Uladzislau Rezki, Baoquan He)
---mm/vmalloc.c| 13 +++++++------1 file changed, 7 insertions(+), 6 deletions(-)mm/vmalloc.c +0
-0@@ -1300,12 +1300,12 @@ find_vmap_lowest_match(struct rb_root *root, unsigned long size,#include <linux/random.h> static struct
vmap_area*mm/vmalloc.c +1
-1-find_vmap_lowest_linear_match(unsigned long size, +find_vmap_lowest_linear_match(struct list_head *head, unsigned long size,unsigned long align, unsigned long vstart)
{ struct vmap_area *va;mm/vmalloc.c +1
-1-list_for_each_entry (va, &free_vmap_area_list, list) { +list_for_each_entry (va, head, list) {if (!is_within_this_va(va, size, align, vstart)) continue;mm/vmalloc.c +0
-0@@ -1316,7 +1316,8 @@ find_vmap_lowest_linear_match(unsigned long size, }static void
mm/vmalloc.c +2
-1-find_vmap_lowest_match_check(unsigned long size, unsigned long align) +find_vmap_lowest_match_check(struct rb_root *root, struct list_head *head, + unsigned long size, unsigned long align){ struct vmap_area *va_1, *va_2; unsigned long vstart;mm/vmalloc.c +3
-3@@ -1325,8 +1326,8 @@ find_vmap_lowest_match_check(unsigned long size, unsigned long align)get_random_bytes (&rnd,sizeof (rnd)); vstart =VMALLOC_START + rnd; - va_1 =find_vmap_lowest_match (size, align, vstart, false); - va_2 =find_vmap_lowest_linear_match (size, align, vstart); + va_1 =find_vmap_lowest_match (root, size, align, vstart, false); + va_2 =find_vmap_lowest_linear_match (head, size, align, vstart);if (va_1 != va_2) pr_emerg("not lowest: t: 0x%p, l: 0x%p, v: 0x%lx\n",@@ -1513,7 +1514,7 @@ __alloc_vmap_area(struct rb_root *root, struct list_head *head,return vend;#if DEBUG_AUGMENT_LOWEST_MATCH_CHECK -find_vmap_lowest_match_check (size, align); +find_vmap_lowest_match_check (root, head, size, align);#endif return nva_start_addr;Signature · 1 line
2.30.2
Uladzislau Rezki
maintainerQuoted 46 lines
Quoted 35 lines · Song Liu
find_vmap_lowest_match()is now able to handle different roots. WithDEBUG_AUGMENT_LOWEST_MATCH_CHECKenabled as:mm/vmalloc.c +1
-1@@ -713,7 +713,7 @@ EXPORT_SYMBOL(vmalloc_to_pfn);/*** Global kva allocator ***/ -#define DEBUG_AUGMENT_LOWEST_MATCH_CHECK 0 +#define DEBUG_AUGMENT_LOWEST_MATCH_CHECK 1compilation failed as:
mm/vmalloc.c: In function 'find_vmap_lowest_match_check':mm/vmalloc.c:1328:32: warning: passing argument 1 of 'find_vmap_lowest_match' makes pointer from integer without a cast [-Wint-conversion] 1328 |va_1=find_vmap_lowest_match(size, align, vstart, false);| ^~~~ | | | long unsigned int mm/vmalloc.c:1236:40: note: expected 'struct rb_root *' but argument is of type 'long unsigned int' 1236 | find_vmap_lowest_match(struct rb_root *root, unsigned long size, | ~~~~~~~~~~~~~~~~^~~~ mm/vmalloc.c:1328:9: error: too few arguments to function 'find_vmap_lowest_match' 1328 | va_1 = find_vmap_lowest_match(size, align, vstart, false); | ^~~~~~~~~~~~~~~~~~~~~~ mm/vmalloc.c:1236:1: note: declared here 1236 | find_vmap_lowest_match(struct rb_root *root, unsigned long size, | ^~~~~~~~~~~~~~~~~~~~~~Quoted 8 lines
Extend
find_vmap_lowest_match_check()andfind_vmap_lowest_linear_match()with extra arguments to fix this.Fixes f9863be49312 ("mm/vmalloc: extend __alloc_vmap_area() with extra arguments")Cc Uladzislau Rezki (Sony) <[email protected]>Cc Baoquan He <[email protected]>Cc Andrew Morton <[email protected]>Signed-off-by Song Liu <[email protected]>Forgot to add the following from v1:
Quoted 3 lines
Reviewed-by Baoquan He <[email protected]>Reviewed-by Uladzislau Rezki (Sony) <[email protected]>
Works great to me. Appreciate it!
--
Uladzislau Rezki