From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-yw1-f69.google.com (mail-yw1-f69.google.com [209.85.161.69]) by kanga.kvack.org (Postfix) with ESMTP id 407D56B000A for ; Wed, 3 Oct 2018 06:48:23 -0400 (EDT) Received: by mail-yw1-f69.google.com with SMTP id u125-v6so2790695ywf.19 for ; Wed, 03 Oct 2018 03:48:23 -0700 (PDT) Received: from hqemgate15.nvidia.com (hqemgate15.nvidia.com. [216.228.121.64]) by mx.google.com with ESMTPS id g63-v6si205008ybg.523.2018.10.03.03.48.21 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 03 Oct 2018 03:48:22 -0700 (PDT) Subject: Re: [PATCH] mm: Avoid swapping in interrupt context References: <1538387115-2363-1-git-send-email-amhetre@nvidia.com> <20181001122400.GF18290@dhcp22.suse.cz> From: Ashish Mhetre Message-ID: <988dfe01-6553-1e0a-1d98-1b3d3aa67517@nvidia.com> Date: Wed, 3 Oct 2018 16:18:37 +0530 MIME-Version: 1.0 In-Reply-To: <20181001122400.GF18290@dhcp22.suse.cz> Content-Type: multipart/alternative; boundary="------------522A1BD076428E4A523FF434" Content-Language: en-US Sender: owner-linux-mm@kvack.org List-ID: To: Michal Hocko Cc: linux-mm@kvack.org, akpm@linux-foundation.org, vdumpa@nvidia.com, Snikam@nvidia.com --------------522A1BD076428E4A523FF434 Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit >How? No allocation request from the interrupt context can use a >sleepable allocation context and that means that no reclaim is allowed >from the IRQ context. Kernel Oops happened when ZRAM was used as swap with zsmalloc as alloctor under memory pressure condition. This is probably because of kmalloc() from IRQ as pointed out by Sergey. >Could you provide the Oops message? BUG_ON() got triggered at https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/tree/mm/zsmalloc.c?h=next-20181002#n1324 with Oops message: [ 264.082531] Internal error: Oops - BUG: 0 [#1] PREEMPT SMP ARM [ 264.088350] Modules linked in: [ 264.091406] CPU: 0 PID: 3805 Comm: kworker/0:4 Tainted: G W 3.10.33-g990282b #1 [ 264.099572] Workqueue: events netstat_work_func [ 264.104097] task: e7b12040 ti: dc7d4000 task.ti: dc7d4000 [ 264.109485] PC is at zs_map_object+0x180/0x18c [ 264.113918] LR is at zram_bvec_rw.isra.15+0x304/0x88c [ 264.118956] pc : [] lr : [] psr: 200f0013 [ 264.118956] sp : dc7d5460 ip : fff00814 fp : 00000002 [ 264.130407] r10: ea8ec000 r9 : ebc93340 r8 : 00000000 [ 264.135618] r7 : c191502c r6 : dc7d4020 r5 : d25f5684 r4 : ec3158c0 [ 264.142128] r3 : 00000200 r2 : 00000002 r1 : c191502c r0 : ea8ec000 On Monday 01 October 2018 05:54 PM, Michal Hocko wrote: > On Mon 01-10-18 15:15:15, Ashish Mhetre wrote: >> From: Sri Krishna chowdary >> >> Pages can be swapped out from interrupt context as well. > How? No allocation request from the interrupt context can use a > sleepable allocation context and that means that no reclaim is allowed > from the IRQ context. > >> ZRAM uses zsmalloc allocator to make room for these pages. >> But zsmalloc is not made to be used from interrupt context. >> This can result in a kernel Oops. > Could you provide the Oops message? --------------522A1BD076428E4A523FF434 Content-Type: text/html; charset="utf-8" Content-Transfer-Encoding: 8bit
>How? No allocation request from the interrupt context can use a
>sleepable allocation context and that means that no reclaim is allowed
>from the IRQ context.
Kernel Oops happened when ZRAM was used as swap with zsmalloc as alloctor
under memory pressure condition.
This is probably because of kmalloc() from IRQ as pointed out by Sergey.

>Could you provide the Oops message?
BUG_ON() got triggered at https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/tree/mm/zsmalloc.c?h=next-20181002#n1324 with Oops message:
[ 264.082531] Internal error: Oops - BUG: 0 [#1] PREEMPT SMP ARMA 
[ 264.088350] Modules linked in:A 
[ 264.091406] CPU: 0 PID: 3805 Comm: kworker/0:4 Tainted: G W 3.10.33-g990282b #1A 
[ 264.099572] Workqueue: events netstat_work_funcA 
[ 264.104097] task: e7b12040 ti: dc7d4000 task.ti: dc7d4000A 
[ 264.109485] PC is at zs_map_object+0x180/0x18cA 
[ 264.113918] LR is at zram_bvec_rw.isra.15+0x304/0x88cA 
[ 264.118956] pc : [<c01581e8>] lr : [<c0456618>] psr: 200f0013A 
[ 264.118956] sp : dc7d5460 ip : fff00814 fp : 00000002A 
[ 264.130407] r10: ea8ec000 r9 : ebc93340 r8 : 00000000A 
[ 264.135618] r7 : c191502c r6 : dc7d4020 r5 : d25f5684 r4 : ec3158c0A 
[ 264.142128] r3 : 00000200 r2 : 00000002 r1 : c191502c r0 : ea8ec000 

On Monday 01 October 2018 05:54 PM, Michal Hocko wrote:
On Mon 01-10-18 15:15:15, Ashish Mhetre wrote:
From: Sri Krishna chowdary <schowdary@nvidia.com>

Pages can be swapped out from interrupt context as well.
How? No allocation request from the interrupt context can use a
sleepable allocation context and that means that no reclaim is allowed
from the IRQ context.

ZRAM uses zsmalloc allocator to make room for these pages.
But zsmalloc is not made to be used from interrupt context.
This can result in a kernel Oops.
Could you provide the Oops message?

--------------522A1BD076428E4A523FF434--