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 8BF01C433ED for ; Thu, 8 Apr 2021 02:44:42 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 2F2F2611AB for ; Thu, 8 Apr 2021 02:44:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2F2F2611AB 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 BA4B66B0081; Wed, 7 Apr 2021 22:44:41 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B7B036B0082; Wed, 7 Apr 2021 22:44:41 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A6B3E6B0083; Wed, 7 Apr 2021 22:44:41 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0050.hostedemail.com [216.40.44.50]) by kanga.kvack.org (Postfix) with ESMTP id 8DB5E6B0081 for ; Wed, 7 Apr 2021 22:44:41 -0400 (EDT) Received: from smtpin16.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 532936D7C for ; Thu, 8 Apr 2021 02:44:41 +0000 (UTC) X-FDA: 78007656762.16.BF1E560 Received: from mail-il1-f176.google.com (mail-il1-f176.google.com [209.85.166.176]) by imf29.hostedemail.com (Postfix) with ESMTP id 612A5D2 for ; Thu, 8 Apr 2021 02:44:39 +0000 (UTC) Received: by mail-il1-f176.google.com with SMTP id o15so494174ilf.11 for ; Wed, 07 Apr 2021 19:44:40 -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=0T4dBN2lN/0Rhs+dOSIlH4GWAZhaTXTwUSmFElYep2A=; b=WfvzXAKPNwAHi5P7wdTkAwFaSlHSOIHP9Sc0yzHCNlvgLWWdlitIOJiZrjN1yZkOD/ 5BmnL3AMQBT1Qxk1GnfF57V2Q0W2QSBp8G6jk0WXVL2G5RRjMtLn0UnhwvXGxXvfSIyC sTsSufdqq0kBcrGRg08OOpm6pwJF6KR57z73KUqRqtv4rwafb6HmoVQwVnpl1cSYLPPo 7oZOrKfgy4su+wjYNccsIXW68GfvCmYouS8fEiFU4uQBTR+KJ83moH/uzkij9SZCoLPX RC/0XZTXd0VB5fBspkl/NfZubQTyZPT4k8xKpJG6c+AlIZjpbVyETBQil2fAfKSolKg1 ZzRA== X-Gm-Message-State: AOAM531YZMzRTY9uUVbhM6kpk0DVZgBqDBi3KechLMMld9wD89viGbLp 9UULbfya0CNvn0UZ0pdcGLA= X-Google-Smtp-Source: ABdhPJwmNE2xv+ybo/jNgpNkjLWw2sSKyUmpjhhjPA94pKn0pZKOreypC6NgiceNc3prItZ3+kFWIg== X-Received: by 2002:a92:d1cb:: with SMTP id u11mr5122276ilg.184.1617849880308; Wed, 07 Apr 2021 19:44:40 -0700 (PDT) Received: from google.com (243.199.238.35.bc.googleusercontent.com. [35.238.199.243]) by smtp.gmail.com with ESMTPSA id d1sm15178920ile.16.2021.04.07.19.44.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Apr 2021 19:44:39 -0700 (PDT) Date: Thu, 8 Apr 2021 02:44:38 +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: <20210407210905.F790.409509F4@e16-tech.com> <20210408072800.6C1F.409509F4@e16-tech.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210408072800.6C1F.409509F4@e16-tech.com> X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 612A5D2 X-Stat-Signature: i7jfkwsjmbcc8ew37t56jq5mdmbbhq4y Received-SPF: none (gmail.com>: No applicable sender policy available) receiver=imf29; identity=mailfrom; envelope-from=""; helo=mail-il1-f176.google.com; client-ip=209.85.166.176 X-HE-DKIM-Result: none/none X-HE-Tag: 1617849879-360660 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000117, 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 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