From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, UNPARSEABLE_RELAY,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2CC89C433B4 for ; Fri, 9 Apr 2021 00:08:01 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 394B961151 for ; Fri, 9 Apr 2021 00:08:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 394B961151 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=e16-tech.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id AE1396B0036; Thu, 8 Apr 2021 20:07:59 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A90F56B006C; Thu, 8 Apr 2021 20:07:59 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 95A266B006E; Thu, 8 Apr 2021 20:07:59 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0252.hostedemail.com [216.40.44.252]) by kanga.kvack.org (Postfix) with ESMTP id 75DDC6B0036 for ; Thu, 8 Apr 2021 20:07:59 -0400 (EDT) Received: from smtpin25.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 3586E182371D9 for ; Fri, 9 Apr 2021 00:07:59 +0000 (UTC) X-FDA: 78010890678.25.8E6D513 Received: from out20-86.mail.aliyun.com (out20-86.mail.aliyun.com [115.124.20.86]) by imf26.hostedemail.com (Postfix) with ESMTP id 7A42C40002D2 for ; Fri, 9 Apr 2021 00:07:54 +0000 (UTC) X-Alimail-AntiSpam:AC=CONTINUE;BC=0.04462716|-1;CH=green;DM=|CONTINUE|false|;DS=CONTINUE|ham_regular_dialog|0.0188873-0.00381009-0.977303;FP=0|0|0|0|0|-1|-1|-1;HT=ay29a033018047209;MF=wangyugui@e16-tech.com;NM=1;PH=DS;RN=4;RT=4;SR=0;TI=SMTPD_---.Jx7cE6R_1617926873; Received: from 192.168.2.112(mailfrom:wangyugui@e16-tech.com fp:SMTPD_---.Jx7cE6R_1617926873) by smtp.aliyun-inc.com(10.147.40.26); Fri, 09 Apr 2021 08:07:53 +0800 Date: Fri, 09 Apr 2021 08:08:00 +0800 From: Wang Yugui To: Dennis Zhou Subject: Re: unexpected -ENOMEM from percpu_counter_init() Cc: Vlastimil Babka , linux-mm@kvack.org, linux-btrfs@vger.kernel.org In-Reply-To: References: <20210408171959.2D72.409509F4@e16-tech.com> Message-Id: <20210409080759.4B68.409509F4@e16-tech.com> MIME-Version: 1.0 Content-Type: text/plain; charset="GB2312" Content-Transfer-Encoding: quoted-printable X-Mailer: Becky! ver. 2.75.03 [en] X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 7A42C40002D2 X-Stat-Signature: fd93e78s1985hq58aotkboykgsferx3s Received-SPF: none (e16-tech.com>: No applicable sender policy available) receiver=imf26; identity=mailfrom; envelope-from=""; helo=out20-86.mail.aliyun.com; client-ip=115.124.20.86 X-HE-DKIM-Result: none/none X-HE-Tag: 1617926874-613958 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Hi, > > kernel: at least 5.10.26/5.10.27/5.10.28 > >=20 > > This problem is triggered by our application, NOT xfstests. > > But our applicaiton have some heavy write load just like xfstest/generi= c/476. > > Our application use at most 75% of memory, if still not enough,=20 > > it will write out all buffer info to filesystem. >=20 > Do you use cgroups at all? If yes can you describe the workload pattern > a bit. cgroups is enabled defaultly, so cgroups is used. This is the output of systemd-cgls, ''samtools.nipt sort -m 60G" is one of our application. but our application is NOT cgroups-aware, and it NOT call any cgroup interface directly. Control group /: -.slice =A9=C0=A9=A4user.slice =A9=A6 =A9=B8=A9=A4user-0.slice =A9=A6 =A9=C0=A9=A4session-55.scope =A9=A6 =A9=A6 =A9=C0=A9=A448747 sshd: root [priv] =A9=A6 =A9=A6 =A9=C0=A9=A448788 sshd: root@notty =A9=A6 =A9=A6 =A9=C0=A9=A448795 perl -e @GNU_Parallel=3Dsplit/_/,"use_IPC= ::Open3;_use_MIME::Base6... =A9=A6 =A9=A6 =A9=C0=A9=A448943 samtools.nipt sort -m 60G -T /nodetmp//nf= s/biowrk/baseline.wgs2... =A9=A6 =A9=A6 =A9=C0=A9=A4.... =A9=A6 =A9=B8=A9=A4user@0.service =A9=A6 =A9=B8=A9=A4init.scope =A9=A6 =A9=C0=A9=A448775 /usr/lib/systemd/systemd --user =A9=A6 =A9=B8=A9=A448781 (sd-pam) =A9=C0=A9=A4init.scope =A9=A6 =A9=B8=A9=A41 /usr/lib/systemd/systemd --switched-root --system --de= serialize 18 =A9=B8=A9=A4system.slice =A9=C0=A9=A4rngd.service =A9=A6 =A9=B8=A9=A41577 /sbin/rngd -f --fill-watermark=3D0 =A9=C0=A9=A4irqbalance.service =A9=A6 =A9=B8=A9=A41543 /usr/sbin/irqbalance --foreground =2E... > > This problem is happen in linux kernel 5.10.x, but not happen in linux > > kernel 5.4.x. It have high frequency to repduce too. >=20 > Ah. Can you try the following patch? > https://lore.kernel.org/lkml/20210408035736.883861-4-guro@fb.com/ >=20 > Thanks, > Dennis kernel: kernel 5.10.28+this patch result: yet not happen after 4 times test. without this path, the reproduce frequency is >50% And a question about this, > > > > upper caller: > > > > nofs_flag =3D memalloc_nofs_save(); > > > > ret =3D btrfs_drew_lock_init(&root->snapshot_lock); > > > > memalloc_nofs_restore(nofs_flag); >=20 > The issue is here. nofs is set which means percpu attempts an atomic > allocation. If it cannot find anything already allocated it isn't happy. > This was done before memalloc_nofs_{save/restore}() were pervasive. >=20 > Percpu should probably try to allocate some pages if possible even if > nofs is set. Should we check and pre-alloc memory inside memalloc_nofs_restore()? another memalloc_nofs_save() may come soon. something like this in memalloc_nofs_save()? if (pcpu_nr_empty_pop_pages[type] < PCPU_EMPTY_POP_PAGES_LOW) pcpu_schedule_balance_work(); by the way, this problem still happen in kernel 5.10.28+this patch. Is this is a PANIC without OOPS? any guide for troubleshooting please. > problem: > OS/VGA console is freezed , and no call trace is outputed. > Just some info is outputed to IPMI/dell iDRAC > 2 | 04/03/2021 | 11:35:01 | OS Critical Stop #0x46 | Run-time critical= stop () | Asserted > 3 | Linux kernel panic: Fatal excep > 4 | Linux kernel panic: tion Best Regards Wang Yugui (wangyugui@e16-tech.com) 2021/04/08