Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp534172ybb; Wed, 1 Apr 2020 05:05:39 -0700 (PDT) X-Google-Smtp-Source: ADFU+vs/ZMnVF19K42ENMC5ObvTTop8fnYD5WN+W3EBALnTp3H9XV0ruiekOS03vMioIhc1ErRn6 X-Received: by 2002:a9d:2215:: with SMTP id o21mr11570276ota.113.1585742739486; Wed, 01 Apr 2020 05:05:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585742739; cv=none; d=google.com; s=arc-20160816; b=NIOPQ8pCUAe1VW9D0Hm8NjxJGEyx+S2v4Y/UDY/hMIZPnY/Bck6B4p/OKWLPfmAweV pa/nTKe5v5GZqt29IG6P+p5YB0SCizsCvKu5+aEYhJ9bhhAzBXkTp38avm4bGGFSHswu 3LUrMmjqWOMuzR3IBZ0K4MBavEocDMuhWA731a1y4QnWe8jA7APTir33YY7nVhrazFaq ld4YGx4OLrmlH4QgcdjDayiz1H0quo6RNzmg5eF3FVgiKi4t5dXVpqMq49lSgYQBXXpa N3cvVvpuoQgegSjshibDSSNeiVIe1Uuslv7oiEBLOdokPLXQZSECxETr+8bE9Ij+QeHa 9/Fg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=2qHESkVe3nhbeIsGwZeWdkb1tB2ydLYFVJb0HdBY5Q8=; b=JPxWSmCiyxMVys8lPH0Yk1jT+LXFryWezSguKFUi0CJpSx/kaer/CQHV5EPhVWhBbl HeZP2hg1KqE2soSJJUbL6kYevSht8pcC+xLqdE5kjLMqdc8hOoHBZbFPIgafup/DTDzx Nd4ksv3GHfHoc4q1o3E8Gc+gZD11tbJzFm4Gzgixm2vUxvSMhW4FG95c92oYf8CXrlP7 Yx3MzLS/1mq498e+Oe++xjnzKSzw3v+oi2wToih/Q/vyWfOU0diJbcN4Ea1Hm3ZqyHHy bOETjlBZdcGypp/vJAO77to5xsiVWvq4Vv6xxUI4Y1GeWx0tWQsq/Xsd4UvCwyduEPGp KLNw== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f63si717945oib.85.2020.04.01.05.05.25; Wed, 01 Apr 2020 05:05:39 -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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732288AbgDAMFH (ORCPT + 99 others); Wed, 1 Apr 2020 08:05:07 -0400 Received: from mail-wr1-f66.google.com ([209.85.221.66]:35475 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732246AbgDAMFG (ORCPT ); Wed, 1 Apr 2020 08:05:06 -0400 Received: by mail-wr1-f66.google.com with SMTP id d5so30308548wrn.2; 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=sZdOXshtKPrMdliQmaplnIfrDHfyEt5qZQZcBHJXaYh04rnsOysfI19HxdOyMyqhDl /JsNfA4qQWIWzLTn1ug5HAffO4AWvl2l6R6zRVUnqNT5kEQh9zbVKL3lxs4cQvFJ9/z0 17FG592k+FTvwoYa1/Y/rHhxKt7ATH4J0EgiGxKoKIqNlcJbE8RRY7vNJ+rrjM6FINqs 4u0hPoCyAPbVzVR1SpGyepJxm7TbZ9iT5jy8wLPa8M6icCpOSmVM+fFLtN5/8/fyGU9a GyDTbhCzAljzwjZToDl4pKMKRP/S6lI8WnUmaa6mGU51fbREPQEJqrijIQap9ay1Itpa shKw== X-Gm-Message-State: ANhLgQ3mcdKZ238CBuiWydXFQHLRPnY83537t7v/33H1YbXKrMZaFEBJ bfuYdUpuS9GygNRoPzxyr7lhbTn/ 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> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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