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=-4.0 required=3.0 tests=BAYES_00,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS 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 9F6D8C433ED for ; Thu, 8 Apr 2021 13:48:37 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 3596B610E5 for ; Thu, 8 Apr 2021 13:48:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3596B610E5 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id B9CE26B0078; Thu, 8 Apr 2021 09:48:36 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B4CC26B007E; Thu, 8 Apr 2021 09:48:36 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A14696B0080; Thu, 8 Apr 2021 09:48:36 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0141.hostedemail.com [216.40.44.141]) by kanga.kvack.org (Postfix) with ESMTP id 853496B0078 for ; Thu, 8 Apr 2021 09:48:36 -0400 (EDT) Received: from smtpin19.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 4789C9891 for ; Thu, 8 Apr 2021 13:48:36 +0000 (UTC) X-FDA: 78009329832.19.5EB458E Received: from mail-io1-f52.google.com (mail-io1-f52.google.com [209.85.166.52]) by imf20.hostedemail.com (Postfix) with ESMTP id 08289DC for ; Thu, 8 Apr 2021 13:48:32 +0000 (UTC) Received: by mail-io1-f52.google.com with SMTP id x17so2307687iog.2 for ; Thu, 08 Apr 2021 06:48:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=nqFalTZx6UQqInKtJAP8wv0+0cnlIJ20nn+ReArcFHs=; b=G3rfN0TTNYMDzXvOa20ipMadss6g6ormQZUaoQS+lnn0nFlWaFkXujPEXFVzWCxLqT 1U2jP7ZApU4WRzG8POs2EJxK+RkCkwqQ/MT2YImhOrxR7FE/FkuyShaa3R+whqEU3tvE umCObKjULK471yq9YdRXbQWYPITts6ZOmIyVNJ/mRTGB0bH4pq0x2kawRysqqZZx4DVq 1EoW9Bu0qkLE25D/ViEGYOicy8jvf5DafYfQayKAj0YpZ393YkNVVjQa9rxbAE6ENfQt VARiSwzrm3BbHq0LLwn4kZyUVR8kQuwHmtD44c5e+/A2FYLtiQlytkgJEZUk6RCXkVqL U9Eg== X-Gm-Message-State: AOAM531vtDTTRxv0P/pwaY41yMkSv40oRGqV5mQ21O5/le0a7bZvbB+X Uakr+krAoYQD7bWHDm8WMdU= X-Google-Smtp-Source: ABdhPJygRcVlCnE+EG8SpExFB05sFGPSVqhgRy/0SX5+I++8/iCrseCHhbgCih2I1eMxXepRwHGPkA== X-Received: by 2002:a5e:8d05:: with SMTP id m5mr6857617ioj.114.1617889715170; Thu, 08 Apr 2021 06:48:35 -0700 (PDT) Received: from google.com (243.199.238.35.bc.googleusercontent.com. [35.238.199.243]) by smtp.gmail.com with ESMTPSA id j8sm3381602ilk.33.2021.04.08.06.48.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Apr 2021 06:48:34 -0700 (PDT) Date: Thu, 8 Apr 2021 13:48:33 +0000 From: Dennis Zhou To: Wang Yugui Cc: Vlastimil Babka , linux-mm@kvack.org, linux-btrfs@vger.kernel.org Subject: Re: unexpected -ENOMEM from percpu_counter_init() Message-ID: References: <20210408072800.6C1F.409509F4@e16-tech.com> <20210408171959.2D72.409509F4@e16-tech.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210408171959.2D72.409509F4@e16-tech.com> X-Rspamd-Queue-Id: 08289DC X-Stat-Signature: 3beuztr1gzjc5ujo365nzgt63jxyfshm X-Rspamd-Server: rspam02 Received-SPF: none (gmail.com>: No applicable sender policy available) receiver=imf20; identity=mailfrom; envelope-from=""; helo=mail-io1-f52.google.com; client-ip=209.85.166.52 X-HE-DKIM-Result: none/none X-HE-Tag: 1617889712-616538 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: On Thu, Apr 08, 2021 at 05:20:00PM +0800, Wang Yugui wrote: > Hi, > > > On Thu, Apr 08, 2021 at 07:28:01AM +0800, Wang Yugui wrote: > > > Hi, > > > > > > > > > > upper caller: > > > > > > > nofs_flag = memalloc_nofs_save(); > > > > > > > ret = btrfs_drew_lock_init(&root->snapshot_lock); > > > > > > > memalloc_nofs_restore(nofs_flag); > > > > > > > > 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. > > > > > > > > Percpu should probably try to allocate some pages if possible even if > > > > nofs is set. > > > > > > Thanks. > > > > > > I will wait for the patch, and then test it. > > > > > > > I'm currently a bit busy with some other things. Adding support I don't > > think will be much work, just a little bit tricky. > > > > I recommend carrying what you have minus the change to reserved percpu > > memory for now. If I'm the one to write it, I'll cc you. > > > > Thanks, > > Dennis > > > In the recent test, another problem is triggered too with my extended > percpu buffer size patch. maybe this info is helpful. > > problem: > OS/VGA console is freezed , and no call stace 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 > 5 | 04/05/2021 | 19:09:14 | OS Critical Stop #0x46 | Run-time critical stop () | Asserted > 6 | Linux kernel panic: Fatal excep > 7 | Linux kernel panic: tion > 8 | 04/06/2021 | 13:08:42 | OS Critical Stop #0x46 | Run-time critical stop () | Asserted > 9 | Linux kernel panic: Fatal excep > a | Linux kernel panic: tion > b | 04/08/2021 | 02:12:46 | OS Critical Stop #0x46 | Run-time critical stop () | Asserted > c | Linux kernel panic: Fatal excep > d | Linux kernel panic: tion Unfortunately non of the above to me is useful. > kernel: at least 5.10.26/5.10.27/5.10.28 > > This problem is triggered by our application, NOT xfstests. > But our applicaiton have some heavy write load just like xfstest/generic/476. > Our application use at most 75% of memory, if still not enough, > it will write out all buffer info to filesystem. Do you use cgroups at all? If yes can you describe the workload pattern a bit. > 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. Ah. Can you try the following patch? https://lore.kernel.org/lkml/20210408035736.883861-4-guro@fb.com/ Thanks, Dennis