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=-7.0 required=3.0 tests=INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable 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 3A345C2D0E7 for ; Wed, 1 Apr 2020 12:05:08 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id DDD7620776 for ; Wed, 1 Apr 2020 12:05:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DDD7620776 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 871B48E0005; Wed, 1 Apr 2020 08:05:06 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 82A448E0001; Wed, 1 Apr 2020 08:05:06 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7383D8E0005; Wed, 1 Apr 2020 08:05:06 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0037.hostedemail.com [216.40.44.37]) by kanga.kvack.org (Postfix) with ESMTP id 5C30C8E0001 for ; Wed, 1 Apr 2020 08:05:06 -0400 (EDT) Received: from smtpin21.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 19F01181AEF15 for ; Wed, 1 Apr 2020 12:05:06 +0000 (UTC) X-FDA: 76659155412.21.news10_66b53ef76964f X-HE-Tag: news10_66b53ef76964f X-Filterd-Recvd-Size: 4630 Received: from mail-wr1-f65.google.com (mail-wr1-f65.google.com [209.85.221.65]) by imf35.hostedemail.com (Postfix) with ESMTP for ; Wed, 1 Apr 2020 12:05:05 +0000 (UTC) Received: by mail-wr1-f65.google.com with SMTP id m17so30188629wrw.11 for ; Wed, 01 Apr 2020 05:05:05 -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=2qHESkVe3nhbeIsGwZeWdkb1tB2ydLYFVJb0HdBY5Q8=; b=LCtrBal6axWFF82T56y12s9fvWCg8SVvXAWhpHEXX1z2hb378wxu7jw7TPq1UB7i9r EbJ/s31TNTrLxJVfl0uVFnNRPFXLvH2a2XnjVEuygFTBYHQYZHu22G7Z1MmYJf11j/oh KK01xWYkCZidsXSzmOyF3YGoqe+nLGbvj7wnwPposJ0rt+izpbJi1fagYwfB+Ujw/HxP xsAsBJ+HlTNt5K6/JmV4FH9guwwZtaDTBSoEu69GK1GD7xohfO2bV5qAhITcBwBeeTd3 DjOcZgCCykPVJm9XghEF8Awtl/OW/bFKBuDhjYVB5kiuH4N4Mfm7ynm7YgaEmSK91DHX bfUw== X-Gm-Message-State: ANhLgQ3hmMlyy+vsd7ZloMgUQMaoYHdwUspggTRAV0iTq94+MAa/i2aK Mxl+/OROQ+w8/GYzimeCoOo= X-Google-Smtp-Source: ADFU+vtfgdGL9hubYcT6d3Hh/gPXpmGPiuRY7Uj/WWVpV52yieI7MXiVPFLc68WpRZK+6w4X9jUCVw== X-Received: by 2002:adf:8187:: with SMTP id 7mr26810166wra.358.1585742704551; Wed, 01 Apr 2020 05:05:04 -0700 (PDT) Received: from localhost (ip-37-188-180-223.eurotel.cz. [37.188.180.223]) by smtp.gmail.com with ESMTPSA id h132sm2546019wmf.18.2020.04.01.05.05.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Apr 2020 05:05:03 -0700 (PDT) Date: Wed, 1 Apr 2020 14:05:02 +0200 From: Michal Hocko To: joel@joelfernandes.org Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, rcu@vger.kernel.org, willy@infradead.org, peterz@infradead.org, neilb@suse.com, vbabka@suse.cz, mgorman@suse.de, Andrew Morton , Josh Triplett , Lai Jiangshan , Mathieu Desnoyers , "Paul E. McKenney" , Steven Rostedt Subject: Re: [PATCH RFC] rcu/tree: Use GFP_MEMALLOC for alloc memory to free memory pattern Message-ID: <20200401120502.GH22681@dhcp22.suse.cz> 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> <30295C90-34DB-469C-9DCD-55DB91938BA9@joelfernandes.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <30295C90-34DB-469C-9DCD-55DB91938BA9@joelfernandes.org> 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 01-04-20 07:14:16, joel@joelfernandes.org wrote: [...] > I am in support of this documentation patch. I would say "consumption of the reserve". Like this? >From afc9c4e56c6dd5f59c1cf5f95ad42a0e7cd78b2e Mon Sep 17 00:00:00 2001 From: Michal Hocko Date: Wed, 1 Apr 2020 14:00:56 +0200 Subject: [PATCH] mm: clarify __GFP_MEMALLOC usage It seems that the existing documentation is not explicit about the expected usage and potential risks enough. While it is calls out that users have to free memory when using this flag it is not really apparent that users have to careful to not deplete memory reserves and that they should implement some sort of throttling wrt. freeing process. This is partly based on Neil's explanation [1]. [1] http://lkml.kernel.org/r/877dz0yxoa.fsf@notabene.neil.brown.name Signed-off-by: Michal Hocko --- include/linux/gfp.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/linux/gfp.h b/include/linux/gfp.h index e5b817cb86e7..e3ab1c0d9140 100644 --- a/include/linux/gfp.h +++ b/include/linux/gfp.h @@ -110,6 +110,9 @@ struct vm_area_struct; * the caller guarantees the allocation will allow more memory to be freed * very shortly e.g. process exiting or swapping. Users either should * be the MM or co-ordinating closely with the VM (e.g. swap over NFS). + * Users of this flag have to be extremely careful to not deplete the reserve + * completely and implement a throttling mechanism which controls the consumption + * of the reserve based on the amount of freed memory. * * %__GFP_NOMEMALLOC is used to explicitly forbid access to emergency reserves. * This takes precedence over the %__GFP_MEMALLOC flag if both are set. -- 2.25.1 -- Michal Hocko SUSE Labs