Skip to content

Commit 066fed5

Browse files
urezkitorvalds
authored andcommitted
mm/vmalloc: check various alignments when debugging
Before we did not guarantee a free block with lowest start address for allocations with alignment >= PAGE_SIZE. Because an alignment overhead was included into a search length like below: length = size + align - 1; doing so we make sure that a bigger block would fit after applying an alignment adjustment. Now there is no such limitation, i.e. any alignment that user wants to apply will result to a lowest address of returned free area. Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Uladzislau Rezki (Sony) <[email protected]> Cc: Christoph Hellwig <[email protected]> Cc: David Hildenbrand <[email protected]> Cc: Hillf Danton <[email protected]> Cc: Matthew Wilcox <[email protected]> Cc: Mel Gorman <[email protected]> Cc: Michal Hocko <[email protected]> Cc: Nicholas Piggin <[email protected]> Cc: Oleksiy Avramchenko <[email protected]> Cc: Ping Fang <[email protected]> Cc: Steven Rostedt <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 9f53197 commit 066fed5

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

mm/vmalloc.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1269,7 +1269,7 @@ find_vmap_lowest_linear_match(unsigned long size,
12691269
}
12701270

12711271
static void
1272-
find_vmap_lowest_match_check(unsigned long size)
1272+
find_vmap_lowest_match_check(unsigned long size, unsigned long align)
12731273
{
12741274
struct vmap_area *va_1, *va_2;
12751275
unsigned long vstart;
@@ -1278,8 +1278,8 @@ find_vmap_lowest_match_check(unsigned long size)
12781278
get_random_bytes(&rnd, sizeof(rnd));
12791279
vstart = VMALLOC_START + rnd;
12801280

1281-
va_1 = find_vmap_lowest_match(size, 1, vstart);
1282-
va_2 = find_vmap_lowest_linear_match(size, 1, vstart);
1281+
va_1 = find_vmap_lowest_match(size, align, vstart);
1282+
va_2 = find_vmap_lowest_linear_match(size, align, vstart);
12831283

12841284
if (va_1 != va_2)
12851285
pr_emerg("not lowest: t: 0x%p, l: 0x%p, v: 0x%lx\n",
@@ -1458,7 +1458,7 @@ __alloc_vmap_area(unsigned long size, unsigned long align,
14581458
return vend;
14591459

14601460
#if DEBUG_AUGMENT_LOWEST_MATCH_CHECK
1461-
find_vmap_lowest_match_check(size);
1461+
find_vmap_lowest_match_check(size, align);
14621462
#endif
14631463

14641464
return nva_start_addr;

0 commit comments

Comments
 (0)