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=-0.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,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 27767C2D0F0 for ; Wed, 1 Apr 2020 14:46:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id EE3D520787 for ; Wed, 1 Apr 2020 14:46:09 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=joelfernandes.org header.i=@joelfernandes.org header.b="I+iBu8zk" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733110AbgDAOqI (ORCPT ); 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-Google-Smtp-Source: ADFU+vtlL32MlDzpQe6oFSRHkl19s5SnsvVysgkEkDVY6eabwhZRZKYQgmqKsDQ1UVtbK0xu+21Ck7cuZWxbfpoFmvE= 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 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=-0.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,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 85A0BC2D0F3 for ; Wed, 1 Apr 2020 14:46:09 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 465BB206F6 for ; Wed, 1 Apr 2020 14:46:09 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=joelfernandes.org header.i=@joelfernandes.org header.b="I+iBu8zk" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 465BB206F6 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=joelfernandes.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id ED5C98E0006; Wed, 1 Apr 2020 10:46:08 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E5E028E0001; Wed, 1 Apr 2020 10:46:08 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D23EC8E0006; Wed, 1 Apr 2020 10:46:08 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0251.hostedemail.com [216.40.44.251]) by kanga.kvack.org (Postfix) with ESMTP id B32FA8E0001 for ; Wed, 1 Apr 2020 10:46:08 -0400 (EDT) Received: from smtpin30.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 6CE9D181AEF10 for ; Wed, 1 Apr 2020 14:46:08 +0000 (UTC) X-FDA: 76659561216.30.wine41_35900b16a2848 X-HE-Tag: wine41_35900b16a2848 X-Filterd-Recvd-Size: 4732 Received: from mail-il1-f194.google.com (mail-il1-f194.google.com [209.85.166.194]) by imf06.hostedemail.com (Postfix) with ESMTP for ; Wed, 1 Apr 2020 14:46:07 +0000 (UTC) Received: by mail-il1-f194.google.com with SMTP id k29so205312ilg.0 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=hnvTZOpgA4SUoV9sYKMmRLQM+gdCa9KcrzD0T2/D2UfsIsZhJ8xeL2GaepOjUO9uXb GUh7+SOQi/+GcdtLYE+E/F7mzjXtIAwMbVzBBWV8kRsC7QerFBtKEDZd6TTlohRYTa5E Wuyj6jo+/lACocEloMSbw8nOudI6bMDhV/AtAsIi960Ds9DpmIeSxJeG88hJ8Lcvt4y0 Yq+kwT7LgW4CXpXazW8bt7gEVOeqf19/Lcy2eF9348zChxT/FQsjyFVlJosQdK4sWjGO 0kp0WDZdVwDRvjIO8i+S3G51SM2I0d8Rp+f0StIXtqCw+aFY9f+9C4YMXju4oaAWdn0o +gGg== X-Gm-Message-State: ANhLgQ2oGtVI/hskINGMQYoYCBszCFJvv8PehHPyROJRPJNm7m9Xrrrt Cf63u294YIcXeJAFguog7bzFGvIB7JcpZIRPIhELbw== X-Google-Smtp-Source: ADFU+vtlL32MlDzpQe6oFSRHkl19s5SnsvVysgkEkDVY6eabwhZRZKYQgmqKsDQ1UVtbK0xu+21Ck7cuZWxbfpoFmvE= 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" 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 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