* [PATCH] mm/kasan: use kasan_zero_pud for p4d table
@ 2017-05-15 6:20 js1304
2017-05-15 8:29 ` Andrey Ryabinin
0 siblings, 1 reply; 2+ messages in thread
From: js1304 @ 2017-05-15 6:20 UTC (permalink / raw)
To: Andrew Morton
Cc: Kirill A . Shutemov, Andrey Ryabinin, Alexander Potapenko,
Dmitry Vyukov, kasan-dev, linux-mm, linux-kernel, kernel-team,
Joonsoo Kim
From: Joonsoo Kim <iamjoonsoo.kim@lge.com>
There is missing optimization in zero_p4d_populate() that can save
some memory when mapping zero shadow. Implement it like as others.
Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@lge.com>
---
mm/kasan/kasan_init.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/mm/kasan/kasan_init.c b/mm/kasan/kasan_init.c
index b96a5f7..554e4c0 100644
--- a/mm/kasan/kasan_init.c
+++ b/mm/kasan/kasan_init.c
@@ -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,
--
2.7.4
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] mm/kasan: use kasan_zero_pud for p4d table
2017-05-15 6:20 [PATCH] mm/kasan: use kasan_zero_pud for p4d table js1304
@ 2017-05-15 8:29 ` Andrey Ryabinin
0 siblings, 0 replies; 2+ messages in thread
From: Andrey Ryabinin @ 2017-05-15 8:29 UTC (permalink / raw)
To: js1304, Andrew Morton
Cc: Kirill A . Shutemov, Alexander Potapenko, Dmitry Vyukov,
kasan-dev, linux-mm, linux-kernel, kernel-team, Joonsoo Kim
On 05/15/2017 09:20 AM, js1304@gmail.com wrote:
> From: Joonsoo Kim <iamjoonsoo.kim@lge.com>
>
> There is missing optimization in zero_p4d_populate() that can save
> some memory when mapping zero shadow. Implement it like as others.
>
> Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Acked-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
> ---
> mm/kasan/kasan_init.c | 12 ++++++++++++
> 1 file changed, 12 insertions(+)
>
> diff --git a/mm/kasan/kasan_init.c b/mm/kasan/kasan_init.c
> index b96a5f7..554e4c0 100644
> --- a/mm/kasan/kasan_init.c
> +++ b/mm/kasan/kasan_init.c
> @@ -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,
>
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-05-15 8:28 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-15 6:20 [PATCH] mm/kasan: use kasan_zero_pud for p4d table js1304
2017-05-15 8:29 ` Andrey Ryabinin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox