Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp680530ybb; Wed, 1 Apr 2020 07:46:44 -0700 (PDT) X-Google-Smtp-Source: ADFU+vvWMFIaVeEzs6gH2C3hU5G2IlTRp4vmm/v+2MEBpvmZZDJnIjCFuZD5HMDXz1iBM0xE+lOC X-Received: by 2002:a9d:2963:: with SMTP id d90mr16073691otb.149.1585752404521; Wed, 01 Apr 2020 07:46:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585752404; cv=none; d=google.com; s=arc-20160816; b=NqAf4SoWtURLWoZck5qBYAb6EQMXh3Qm6XQ6Kz7lftaa9Ju+qMdiqO/+7TLIrTRQAT eGw/P5GwDl7vftwl4SmtBd4qPPxvCx2Ok9Fdv3sLHEs2oeBk54FZoCL0a7G2Z66P9Ttd MmBTBRFjIcA1EtaiAu3+nDzAkcA6a641YUGQOvHWQPHr72bog5WmXN7a60ba61Nersae S9L8aTZAL3/UHVYEiV+SoW7CFOdQGnNKup53POjp7KGj69c9BZcYYao1rXGZmpTGYFEq kqD/nfSs5sABUnGQrYuCBb8KtOM37g+Qt52CKfFi3IfuMGZjiIsiOPJ/AqPPd3LuP7DX bumw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=ZcglO/uhS0ifb7KGuROmO8gY0j2umpsbqPd9xyiG0o8=; b=nzoXLYqR6ARoyx2wguao2Mc97yUKoepUCD3EMJ9lpCVpE+cH3jeT/wIw/iBct8Tshf q8hgr3ywur2+CGbn1UXb/dfP/guVWsB8CkNMbFj0ivZHigYe6pMCNoMUpMhn/+jru+sd iOfhH3ywbry4QuRdeRx2YO4Evc6mu4EIt3dAknYawKJsJcONpxf7MAv+AcZbrmcpdUjq x8kZo0Zxa3926vl6NNyilO9eSmQPAggz7TS7ks6or1i013pAq+ZsSMtrL+NK7CRnnUSI nDqq1jJJZx4G9IwIWkhcsk1XRfSth8xUb23BXgFB6QlHwXkpQNieiLzk0JBz0n19BWob Od5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=I+iBu8zk; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p189si970613oic.178.2020.04.01.07.46.30; Wed, 01 Apr 2020 07:46:44 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=I+iBu8zk; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733104AbgDAOqI (ORCPT + 99 others); Wed, 1 Apr 2020 10:46:08 -0400 Received: from mail-il1-f193.google.com ([209.85.166.193]:42442 "EHLO mail-il1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732897AbgDAOqI (ORCPT ); Wed, 1 Apr 2020 10:46:08 -0400 Received: by mail-il1-f193.google.com with SMTP id f16so140052ilj.9 for ; Wed, 01 Apr 2020 07:46:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joelfernandes.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ZcglO/uhS0ifb7KGuROmO8gY0j2umpsbqPd9xyiG0o8=; b=I+iBu8zkO552J01jKV6fjakpR39blBjN+08eSYXhfKl4ues3EMOfaeK290YIVMWt4+ /IlgX8Z/17KBiwgFwox22rIS1MsLPRSBPaPqLKPDhIOHOX2BApZdxTkwFW/XfDUN9h5X iQN4oomqdvHygKtip5nD6/Ighto6NGAD14uJA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ZcglO/uhS0ifb7KGuROmO8gY0j2umpsbqPd9xyiG0o8=; b=DVI4P7pR9qhIQ+CyvoeS0Gw1Urb9Nq1f7OWZpPaC7K2+3PfpBODS8Ge7x1M0qRSw7H ykYdsgjWREqvfQ8aTBlHCnkSI+iYWSKHCn+hIkGrrmdi47gHYsmPplcJMXiMpXMOS8Oz EIEV06WxFcxUqvQDaM8o1z5gxASZKvGYqJS3q9U750XAWV964GVbOh70pwOi5ML0gdOj kS5QMblKbk4Q1JJqx1eEFHXmSXB8jBxJHlppT/skWYeL7EIJmRw17wMm6vsfkdz54t15 x0OuIywyES8ABDmaan3MKlCuAR49ihMfrYlGkJEJZdGa/0ORx8BDwg2qkPKrD3cS68Rn HtyQ== X-Gm-Message-State: ANhLgQ2kI+miJx0dicr5aDbtBNUvwdyM2x4xES/fDrjDQhd5EG2q3iT+ ac69Pot3z3ncVXq4KMjXlBUf4WEEQOfGIyR2RPZ3Hw== X-Received: by 2002:a92:844f:: with SMTP id l76mr22924204ild.13.1585752367189; Wed, 01 Apr 2020 07:46:07 -0700 (PDT) MIME-Version: 1.0 References: <20200331131628.153118-1-joel@joelfernandes.org> <20200331145806.GB236678@google.com> <20200331153450.GM30449@dhcp22.suse.cz> <20200331160117.GA170994@google.com> <20200401072359.GC22681@dhcp22.suse.cz> <20200401131426.GN3772@suse.de> In-Reply-To: <20200401131426.GN3772@suse.de> From: Joel Fernandes Date: Wed, 1 Apr 2020 10:45:56 -0400 Message-ID: Subject: Re: [PATCH RFC] rcu/tree: Use GFP_MEMALLOC for alloc memory to free memory pattern To: Mel Gorman Cc: Michal Hocko , LKML , linux-mm , rcu , Matthew Wilcox , Peter Zijlstra , Neil Brown , Vlastimil Babka , Andrew Morton , Josh Triplett , Lai Jiangshan , Mathieu Desnoyers , "Paul E. McKenney" , Steven Rostedt Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Apr 1, 2020 at 9:14 AM Mel Gorman wrote: > > On Wed, Apr 01, 2020 at 09:23:59AM +0200, Michal Hocko wrote: > > > Can you suggest what prevents other users of GFP_MEMALLOC from doing that > > > also? > > > > There is no explicit mechanism which is indeed unfortunate. The only > > user real user of the flag is Swap over NFS AFAIK. I have never dared to > > look into details on how the complete reserves depletion is prevented. > > Mel would be much better fit here. > > > > It's "prevented" by the fact that every other memory allocation request > that is not involved with reclaiming memory gets stalled in the allocator > with only the swap subsystem making any progress until the machine > recovers. Potentially only kswapd is still running until the system > recovers if stressed hard enough. > > The naming is terrible but is mased on kswapd's use of the PF_MEMALLOC > flag. For swap-over-nfs, GFP_MEMALLOC saying "this allocation request is > potentially needed for kswapd to make forward progress and not freeze". > > I would not be comfortable with kfree_rcu() doing the same thing because > there can be many callers in parallel and it's freeing slab objects. > Swap over NFS should free at least one page, freeing a slab object is > not guaranteed to free anything. Got it Mel. Just to clarify to the onlooker. It seemed to fit the pattern that's why I proposed it as RFC, I was never sure it was the right approach -- I just proposed it for discussion-sake because I thought it was worth talking about at least. It was not even merged in my tree, was just RFC. Thanks Mel for clarifying the usage of the flag. - Joel