From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f69.google.com (mail-wm0-f69.google.com [74.125.82.69]) by kanga.kvack.org (Postfix) with ESMTP id B31D26B0038 for ; Thu, 27 Apr 2017 14:24:46 -0400 (EDT) Received: by mail-wm0-f69.google.com with SMTP id m123so1757097wma.5 for ; Thu, 27 Apr 2017 11:24:46 -0700 (PDT) Received: from mail-wm0-x235.google.com (mail-wm0-x235.google.com. [2a00:1450:400c:c09::235]) by mx.google.com with ESMTPS id g3si4042595wmc.70.2017.04.27.11.24.45 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 27 Apr 2017 11:24:45 -0700 (PDT) Received: by mail-wm0-x235.google.com with SMTP id u65so24129468wmu.1 for ; Thu, 27 Apr 2017 11:24:45 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (1.0) Subject: Re: [PATCH 0/3 v3] ARM/ARM64: silence large module first time allocation From: Ard Biesheuvel In-Reply-To: <20170427181902.28829-1-f.fainelli@gmail.com> Date: Thu, 27 Apr 2017 19:24:42 +0100 Content-Transfer-Encoding: quoted-printable Message-Id: <56EE35F5-97F9-4EA4-894B-581E7AE09A78@linaro.org> References: <20170427181902.28829-1-f.fainelli@gmail.com> Sender: owner-linux-mm@kvack.org List-ID: To: Florian Fainelli Cc: linux-arm-kernel@lists.infradead.org, Russell King , Catalin Marinas , Will Deacon , Andrew Morton , Michal Hocko , zijun_hu , "Kirill A. Shutemov" , Andrey Ryabinin , Chris Wilson , open list , "open list:MEMORY MANAGEMENT" , angus@angusclark.org > On 27 Apr 2017, at 19:18, Florian Fainelli wrote: >=20 > With kernels built with CONFIG_ARM{,64}_MODULES_PLTS=3Dy, the first alloca= tion > done from module space will fail, produce a general OOM allocation and als= o a > vmap warning. The second allocation from vmalloc space may or may not be > successful, but is actually the one we are interested about in these cases= . >=20 > This patch series passed __GFP_NOWARN to silence such allocations from the= > ARM/ARM64 module loader's first time allocation when the MODULES_PLT optio= n is > enabled, and also makes alloc_vmap_area() react to the caller setting > __GFP_NOWARN to silence "vmap allocation for size..." messages. >=20 >=20 > Changes in v3: > - check for __GFP_NOWARN not set where the check for printk_ratelimited() > is done, add Michal's Acked-by >=20 > - use C conditionals and not CPP conditionals for IS_ENABLED(), add Ard's > Reviewed-by tag >=20 Ok these look fine now. But are you sure that omitting the single pr_warn() g= ets rid of all of that? Or do we need more patches on top? > Changes in v2: >=20 > - check __GFP_NOWARN out of the printk_ratelimited() check (Michal) >=20 > Here is an example of what we would get without these two patches, pretty > scary huh? >=20 > # insmod /mnt/nfs/huge.ko=20 > [ 22.114143] random: nonblocking pool is initialized > [ 22.183575] vmap allocation for size 15736832 failed: use vmalloc=3D to increase size. > [ 22.191873] vmalloc: allocation failure: 15729534 bytes > [ 22.197112] insmod: page allocation failure: order:0, mode:0xd0 > [ 22.203048] CPU: 2 PID: 1506 Comm: insmod Tainted: G O 4.1= .20-1.9pre-01082-gbbbff07bc3ce #9 > [ 22.212536] Hardware name: Broadcom STB (Flattened Device Tree) > [ 22.218480] [] (unwind_backtrace) from [] (show_sta= ck+0x10/0x14) > [ 22.226238] [] (show_stack) from [] (dump_stack+0x9= 0/0xa4) > [ 22.233473] [] (dump_stack) from [] (warn_alloc_fai= led+0x104/0x144) > [ 22.241490] [] (warn_alloc_failed) from [] (__vmall= oc_node_range+0x170/0x218) > [ 22.250375] [] (__vmalloc_node_range) from [] (modu= le_alloc+0x50/0xac) > [ 22.258651] [] (module_alloc) from [] (module_alloc= _update_bounds+0xc/0x6c) > [ 22.267360] [] (module_alloc_update_bounds) from []= (load_module+0x8ec/0x2058) > [ 22.276329] [] (load_module) from [] (SyS_init_modu= le+0xf0/0x174) > [ 22.284170] [] (SyS_init_module) from [] (ret_fast_= syscall+0x0/0x3c) > [ 22.292277] Mem-Info: > [ 22.294567] active_anon:5236 inactive_anon:1773 isolated_anon:0 > [ 22.294567] active_file:1 inactive_file:3822 isolated_file:0 > [ 22.294567] unevictable:0 dirty:0 writeback:0 unstable:0 > [ 22.294567] slab_reclaimable:238 slab_unreclaimable:1594 > [ 22.294567] mapped:855 shmem:2950 pagetables:36 bounce:0 > [ 22.294567] free:39031 free_pcp:198 free_cma:3928 > [ 22.327196] DMA free:156124kB min:1880kB low:2348kB high:2820kB active_= anon:20944kB inactive_anon:7092kB active_file:4kB inactive_file:15288kB unev= ictable:0kB isolated(anon):0kB isolated(file):0kB present:262144kB managed:2= 27676kB mlocked:0kB dirty:0kB writeback:0kB mapped:3420kB shmem:11800kB slab= _reclaimable:952kB slab_unreclaimable:6376kB kernel_stack:560kB pagetables:1= 44kB unstable:0kB bounce:0kB free_pcp:792kB local_pcp:68kB free_cma:15712kB w= riteback_tmp:0kB pages_scanned:0 all_unreclaimable? no > [ 22.371631] lowmem_reserve[]: 0 0 0 0 > [ 22.375372] HighMem free:0kB min:128kB low:128kB high:128kB active_anon= :0kB inactive_anon:0kB active_file:0kB inactive_file:0kB unevictable:0kB iso= lated(anon):0kB isolated(file):0kB present:2883584kB managed:0kB mlocked:0kB= dirty:0kB writeback:0kB mapped:0kB shmem:0kB slab_reclaimable:0kB slab_unre= claimable:0kB kernel_stack:0kB pagetables:0kB unstable:0kB bounce:0kB free_p= cp:0kB local_pcp:0kB free_cma:0kB writeback_tmp:0kB pages_scanned:0 all_unre= claimable? yes > [ 22.416249] lowmem_reserve[]: 0 0 0 0 > [ 22.419986] DMA: 3*4kB (UEM) 4*8kB (UE) 1*16kB (M) 4*32kB (UEMC) 3*64kB= (EMC) 1*128kB (E) 4*256kB (UEMC) 2*512kB (UE) 2*1024kB (MC) 4*2048kB (UEMC)= 35*4096kB (MRC) =3D 156156kB > [ 22.435922] HighMem: 0*4kB 0*8kB 0*16kB 0*32kB 0*64kB 0*128kB 0*256kB 0= *512kB 0*1024kB 0*2048kB 0*4096kB =3D 0kB > [ 22.446130] 6789 total pagecache pages > [ 22.449889] 0 pages in swap cache > [ 22.453212] Swap cache stats: add 0, delete 0, find 0/0 > [ 22.458447] Free swap =3D 0kB > [ 22.461334] Total swap =3D 0kB > [ 22.464222] 786432 pages RAM > [ 22.467110] 720896 pages HighMem/MovableOnly > [ 22.471388] 725417 pages reserved > [ 22.474711] 4096 pages cma reserved > [ 22.511310] big_init: I am a big module using 3932160 bytes of data! >=20 > Florian Fainelli (3): > mm: Silence vmap() allocation failures based on caller gfp_flags > ARM: Silence first allocation with CONFIG_ARM_MODULE_PLTS=3Dy > arm64: Silence first allocation with CONFIG_ARM64_MODULE_PLTS=3Dy >=20 > arch/arm/kernel/module.c | 11 +++++++++-- > arch/arm64/kernel/module.c | 7 ++++++- > mm/vmalloc.c | 2 +- > 3 files changed, 16 insertions(+), 4 deletions(-) >=20 > --=20 > 2.9.3 >=20 -- 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: email@kvack.org