linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Alexander Potapenko <glider@google.com>
To: Andrey Ryabinin <aryabinin@virtuozzo.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Dave Jones <davej@codemonkey.org.uk>,
	Vegard Nossum <vegard.nossum@oracle.com>,
	Sasha Levin <alexander.levin@verizon.com>,
	Dmitry Vyukov <dvyukov@google.com>,
	kasan-dev <kasan-dev@googlegroups.com>,
	LKML <linux-kernel@vger.kernel.org>,
	Linux Memory Management List <linux-mm@kvack.org>
Subject: Re: [PATCH 2/6] mm/kasan: don't reduce quarantine in atomic contexts
Date: Tue, 2 Aug 2016 13:42:20 +0200	[thread overview]
Message-ID: <CAG_fn=W6DAYeYgo5a-28zt=sCY8LAMP6Yi35a6Aq_C_=dX=yUg@mail.gmail.com> (raw)
In-Reply-To: <1470062715-14077-2-git-send-email-aryabinin@virtuozzo.com>

On Mon, Aug 1, 2016 at 4:45 PM, Andrey Ryabinin <aryabinin@virtuozzo.com> wrote:
> Currently we call quarantine_reduce() for ___GFP_KSWAPD_RECLAIM
> (implied by __GFP_RECLAIM) allocation. So, basically we call it on
> almost every allocation. quarantine_reduce() sometimes is heavy operation,
> and calling it with disabled interrupts may trigger hard LOCKUP:
>
>  NMI watchdog: Watchdog detected hard LOCKUP on cpu 2irq event stamp: 1411258
>  Call Trace:
>   <NMI>  [<ffffffff98a48532>] dump_stack+0x68/0x96
>   [<ffffffff98357fbb>] watchdog_overflow_callback+0x15b/0x190
>   [<ffffffff9842f7d1>] __perf_event_overflow+0x1b1/0x540
>   [<ffffffff98455b14>] perf_event_overflow+0x14/0x20
>   [<ffffffff9801976a>] intel_pmu_handle_irq+0x36a/0xad0
>   [<ffffffff9800ba4c>] perf_event_nmi_handler+0x2c/0x50
>   [<ffffffff98057058>] nmi_handle+0x128/0x480
>   [<ffffffff980576d2>] default_do_nmi+0xb2/0x210
>   [<ffffffff980579da>] do_nmi+0x1aa/0x220
>   [<ffffffff99a0bb07>] end_repeat_nmi+0x1a/0x1e
>   <<EOE>>  [<ffffffff981871e6>] __kernel_text_address+0x86/0xb0
>   [<ffffffff98055c4b>] print_context_stack+0x7b/0x100
>   [<ffffffff98054e9b>] dump_trace+0x12b/0x350
>   [<ffffffff98076ceb>] save_stack_trace+0x2b/0x50
>   [<ffffffff98573003>] set_track+0x83/0x140
>   [<ffffffff98575f4a>] free_debug_processing+0x1aa/0x420
>   [<ffffffff98578506>] __slab_free+0x1d6/0x2e0
>   [<ffffffff9857a9b6>] ___cache_free+0xb6/0xd0
>   [<ffffffff9857db53>] qlist_free_all+0x83/0x100
>   [<ffffffff9857df07>] quarantine_reduce+0x177/0x1b0
>   [<ffffffff9857c423>] kasan_kmalloc+0xf3/0x100
>
> Reduce the quarantine_reduce iff direct reclaim is allowed.
>
> Fixes: 55834c59098d("mm: kasan: initial memory quarantine implementation")
> Reported-by: Dave Jones <davej@codemonkey.org.uk>
> Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
Acked-by: Alexander Potapenko <glider@google.com>
> ---
>  mm/kasan/kasan.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/mm/kasan/kasan.c b/mm/kasan/kasan.c
> index 3019cec..c99ef40 100644
> --- a/mm/kasan/kasan.c
> +++ b/mm/kasan/kasan.c
> @@ -565,7 +565,7 @@ void kasan_kmalloc(struct kmem_cache *cache, const void *object, size_t size,
>         unsigned long redzone_start;
>         unsigned long redzone_end;
>
> -       if (flags & __GFP_RECLAIM)
> +       if (gfpflags_allow_blocking(flags))
>                 quarantine_reduce();
>
>         if (unlikely(object == NULL))
> @@ -596,7 +596,7 @@ void kasan_kmalloc_large(const void *ptr, size_t size, gfp_t flags)
>         unsigned long redzone_start;
>         unsigned long redzone_end;
>
> -       if (flags & __GFP_RECLAIM)
> +       if (gfpflags_allow_blocking(flags))
>                 quarantine_reduce();
>
>         if (unlikely(ptr == NULL))
> --
> 2.7.3
>



-- 
Alexander Potapenko
Software Engineer

Google Germany GmbH
Erika-Mann-Straße, 33
80636 München

Geschäftsführer: Matthew Scott Sucherman, Paul Terence Manicle
Registergericht und -nummer: Hamburg, HRB 86891
Sitz der Gesellschaft: Hamburg

--
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>

  reply	other threads:[~2016-08-02 11:42 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-01 14:45 [PATCH 1/6] mm/kasan: fix corruptions and false positive reports Andrey Ryabinin
2016-08-01 14:45 ` [PATCH 2/6] mm/kasan: don't reduce quarantine in atomic contexts Andrey Ryabinin
2016-08-02 11:42   ` Alexander Potapenko [this message]
2016-08-01 14:45 ` [PATCH 3/6] mm/kasan, slub: don't disable interrupts when object leaves quarantine Andrey Ryabinin
2016-08-01 14:47   ` Alexander Potapenko
2016-08-01 14:45 ` [PATCH 4/6] mm/kasan: get rid of ->alloc_size in struct kasan_alloc_meta Andrey Ryabinin
2016-08-01 14:45 ` [PATCH 5/6] mm/kasan: get rid of ->state " Andrey Ryabinin
2016-08-02 12:37   ` Alexander Potapenko
2016-08-01 14:45 ` [PATCH 6/6] kasan: improve double-free reports Andrey Ryabinin
2016-08-02 11:39   ` Alexander Potapenko
2016-08-02 12:05     ` Alexander Potapenko
2016-08-02 12:34     ` Andrey Ryabinin
2016-08-02 12:53       ` Alexander Potapenko
2016-08-02 16:00     ` [PATCH] kasan-improve-double-free-reports-fix Andrey Ryabinin
2016-08-01 14:45 ` [PATCH 1/6] mm/kasan: fix corruptions and false positive reports Alexander Potapenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAG_fn=W6DAYeYgo5a-28zt=sCY8LAMP6Yi35a6Aq_C_=dX=yUg@mail.gmail.com' \
    --to=glider@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=alexander.levin@verizon.com \
    --cc=aryabinin@virtuozzo.com \
    --cc=davej@codemonkey.org.uk \
    --cc=dvyukov@google.com \
    --cc=kasan-dev@googlegroups.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=vegard.nossum@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox