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=INCLUDES_PATCH, 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 DEE0BC43331 for ; Tue, 31 Mar 2020 15:34:56 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id A94F420848 for ; Tue, 31 Mar 2020 15:34:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A94F420848 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 41BE96B0032; Tue, 31 Mar 2020 11:34:56 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3CBE76B0037; Tue, 31 Mar 2020 11:34:56 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2BA256B0070; Tue, 31 Mar 2020 11:34:56 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0192.hostedemail.com [216.40.44.192]) by kanga.kvack.org (Postfix) with ESMTP id 1247C6B0032 for ; Tue, 31 Mar 2020 11:34:56 -0400 (EDT) Received: from smtpin29.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id B1C0D180AD817 for ; Tue, 31 Mar 2020 15:34:55 +0000 (UTC) X-FDA: 76656055350.29.hope15_824ff2b6cb516 X-HE-Tag: hope15_824ff2b6cb516 X-Filterd-Recvd-Size: 3765 Received: from mail-wr1-f67.google.com (mail-wr1-f67.google.com [209.85.221.67]) by imf10.hostedemail.com (Postfix) with ESMTP for ; Tue, 31 Mar 2020 15:34:55 +0000 (UTC) Received: by mail-wr1-f67.google.com with SMTP id h15so26516390wrx.9 for ; Tue, 31 Mar 2020 08:34:55 -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=XWJpdT6ZsPCOgPe98UycjXxzkHnMVRDPn15M3ka7UM4=; b=lsplEdecpZDE2dT0PQmIurl3zYgj9PtFuQ/teDgWV64XQxLKFvwfJ9WrS+/IzFb6Lk vLSBIcaLYzjks+hevjIUc/x1HdnMiIPh/gwwcqxgmzmrR1fSIIptMuR/L9Hu4r4g8x2+ 8Tz4GUBlwRWWtcDY0FXG+wSsj76CooMJAL4pruv1lPVo3ueb08xZwq9Yyl2YIcBL8KjO eyWNGbRBgKSD2M361+ErbB76UB6vcR3FeqANJJdCXfY7DUAa177ByYz7DImHtPg4vTW6 MNie9a9rsxt19eklQUahee7kBXzgnDBQv5qEWzg+4lOfkE/fCSDm0qyPZ9sshwXHKQsa I5Pg== X-Gm-Message-State: ANhLgQ0gWkJHq1vu6iBsG5MdD2hJR7g56pCKcUKYJ2bw17/n2f4FBeZZ YpFg1BtN3e2as+IBd3YzdUxV2BnD X-Google-Smtp-Source: ADFU+vtOC9s0hgunzjXryLDkoY30klCWAusuNW8kiJdYJ6kgbFjbK79bnAt6gZ6I6SlD2xgVK1GhVQ== X-Received: by 2002:adf:ef08:: with SMTP id e8mr22284875wro.66.1585668894424; Tue, 31 Mar 2020 08:34:54 -0700 (PDT) Received: from localhost (ip-37-188-180-223.eurotel.cz. [37.188.180.223]) by smtp.gmail.com with ESMTPSA id o16sm24444126wrw.75.2020.03.31.08.34.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Mar 2020 08:34:53 -0700 (PDT) Date: Tue, 31 Mar 2020 17:34:50 +0200 From: Michal Hocko To: Joel Fernandes 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: <20200331153450.GM30449@dhcp22.suse.cz> References: <20200331131628.153118-1-joel@joelfernandes.org> <20200331145806.GB236678@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200331145806.GB236678@google.com> 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 Tue 31-03-20 10:58:06, Joel Fernandes wrote: [...] > > diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c > > index 4be763355c9fb..965deefffdd58 100644 > > --- a/kernel/rcu/tree.c > > +++ b/kernel/rcu/tree.c > > @@ -3149,7 +3149,7 @@ static inline struct rcu_head *attach_rcu_head_to_object(void *obj) > > > > if (!ptr) > > ptr = kmalloc(sizeof(unsigned long *) + > > - sizeof(struct rcu_head), GFP_ATOMIC | __GFP_NOWARN); > > + sizeof(struct rcu_head), GFP_MEMALLOC); > > Just to add, the main requirements here are: > 1. Allocation should be bounded in time. > 2. Allocation should try hard (possibly tapping into reserves) > 3. Sleeping is Ok but should not affect the time bound. __GFP_ATOMIC | __GFP_HIGH is the way to get an additional access to memory reserves regarless of the sleeping status. Using __GFP_MEMALLOC is quite dangerous because it can deplete _all_ the memory. What does prevent the above code path to do that? If a partial access to reserves is sufficient then why the existing modifiers (mentioned above are not sufficient? -- Michal Hocko SUSE Labs