Skip to content

Commit

Permalink
mm/kasan/kasan_init.c: use kasan_zero_pud for p4d table
Browse files Browse the repository at this point in the history
There is missing optimization in zero_p4d_populate() that can save some
memory when mapping zero shadow.  Implement it like as others.

Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Joonsoo Kim <[email protected]>
Acked-by: Andrey Ryabinin <[email protected]>
Cc: "Kirill A . Shutemov" <[email protected]>
Cc: Alexander Potapenko <[email protected]>
Cc: Dmitry Vyukov <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
JoonsooKim authored and torvalds committed Jul 10, 2017
1 parent cf8e0fe commit 458f792
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions mm/kasan/kasan_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,18 @@ static void __init zero_p4d_populate(pgd_t *pgd, unsigned long addr,

do {
next = p4d_addr_end(addr, end);
if (IS_ALIGNED(addr, P4D_SIZE) && end - addr >= P4D_SIZE) {
pud_t *pud;
pmd_t *pmd;

p4d_populate(&init_mm, p4d, lm_alias(kasan_zero_pud));
pud = pud_offset(p4d, addr);
pud_populate(&init_mm, pud, lm_alias(kasan_zero_pmd));
pmd = pmd_offset(pud, addr);
pmd_populate_kernel(&init_mm, pmd,
lm_alias(kasan_zero_pte));
continue;
}

if (p4d_none(*p4d)) {
p4d_populate(&init_mm, p4d,
Expand Down

0 comments on commit 458f792

Please sign in to comment.