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 A847FC2D0F3 for ; Wed, 1 Apr 2020 15:28:12 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 4A7FA212CC for ; Wed, 1 Apr 2020 15:28:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4A7FA212CC 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 984DC8E0005; Wed, 1 Apr 2020 11:28:11 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 933D08E0001; Wed, 1 Apr 2020 11:28:11 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 848B18E0005; Wed, 1 Apr 2020 11:28:11 -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 6A8518E0001 for ; Wed, 1 Apr 2020 11:28:11 -0400 (EDT) Received: from smtpin02.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 241D7824805A for ; Wed, 1 Apr 2020 15:28:11 +0000 (UTC) X-FDA: 76659667182.02.meal53_81a2276e76051 X-HE-Tag: meal53_81a2276e76051 X-Filterd-Recvd-Size: 5110 Received: from mail-wm1-f67.google.com (mail-wm1-f67.google.com [209.85.128.67]) by imf35.hostedemail.com (Postfix) with ESMTP for ; Wed, 1 Apr 2020 15:28:10 +0000 (UTC) Received: by mail-wm1-f67.google.com with SMTP id c81so120840wmd.4 for ; Wed, 01 Apr 2020 08:28:10 -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=7vaNO/Vf7ZJ182A/f/+CJjHbWmzGxcMlfGPY3Ppq/aE=; b=Pq5u71A+a9ol4f/xLbhr2q+Ohi05Z872EP/Yl+4ijdjVc/Ygu+niIThGdWUR4qBVys otBqXVa3yLGK4dOrZuJRsHfcVsPcJLNiSjLYOe3+QsJdyqvaBZ1HNMJO4LKRMv+2rBUJ KgOQW1vLRzI91Yj2p3Rk0M5eTC4dZNS8oKdiunfaUmi4GVWUCO/QhyBtrOTFtbLszBYf G9WoXG1VKHV561zjUJtjXQs+SkOsgJ9t8Lh872pkRjI5LZM4z/Zf+WX42QcLeTkfkKqw tX8kcIzJCDsn6A4UexdFc/0sdy6uWbMTWJ6i7hK1NZ+R5kcxFMR1vGb2XVCRR+0yhno8 c4qQ== X-Gm-Message-State: AGi0PuZbHTueqk+UZWZbqmCAeagE8o96nGgAzipc9cqP2a5lHozWiwsp cWPsqYKtJeu5u3yrlHP/AHk= X-Google-Smtp-Source: APiQypKRGw54qCqRgzbgwcP4pMmETIbqZke35Pmh0cO/xsnw3kjzHX9FNr57yLo1BlH86iJ+mTJVxQ== X-Received: by 2002:a7b:c208:: with SMTP id x8mr2522021wmi.178.1585754889604; Wed, 01 Apr 2020 08:28:09 -0700 (PDT) Received: from localhost (ip-37-188-180-223.eurotel.cz. [37.188.180.223]) by smtp.gmail.com with ESMTPSA id q8sm3787379wrc.8.2020.04.01.08.28.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Apr 2020 08:28:08 -0700 (PDT) Date: Wed, 1 Apr 2020 17:28:05 +0200 From: Michal Hocko To: Uladzislau Rezki Cc: Joel Fernandes , 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: <20200401152805.GN22681@dhcp22.suse.cz> References: <20200331131628.153118-1-joel@joelfernandes.org> <20200331145806.GB236678@google.com> <20200331153450.GM30449@dhcp22.suse.cz> <20200331161215.GA27676@pc636> <20200401070958.GB22681@dhcp22.suse.cz> <20200401123230.GB32593@pc636> <20200401125503.GJ22681@dhcp22.suse.cz> <20200401130816.GA1320@pc636> <20200401131528.GK22681@dhcp22.suse.cz> <20200401132258.GA1953@pc636> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200401132258.GA1953@pc636> 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 15:22:58, Uladzislau Rezki wrote: > > > We call it from atomic context, so we can not sleep, also we do not have > > > any existing context coming from the caller. I see that GFP_ATOMIC is high-level > > > flag and is differ from __GFP_ATOMIC. It is defined as: > > > > > > #define GFP_ATOMIC (__GFP_HIGH|__GFP_ATOMIC|__GFP_KSWAPD_RECLAIM) > > > > > > so basically we would like to have __GFP_KSWAPD_RECLAIM that is included in it, > > > because it will also help in case of high memory pressure and wake-up kswapd to > > > reclaim memory. > > > > > > We also can extract: > > > > > > __GFP_ATOMIC | __GFP_HIGH | __GFP_RETRY_MAYFAIL | __GFP_KSWAPD_RECLAIM > > > > > > but that is longer then > > > > > > GFP_ATMOC | __GFP_RETRY_MAYFAIL > > > > OK, if you are always in the atomic context then GFP_ATOMIC is > > sufficient. __GFP_RETRY_MAYFAIL will make no difference for allocations > > which do not reclaim (and thus not retry). Sorry this was not clear to > > me from the previous description. > > > Ahh. OK. Then adding __GFP_RETRY_MAYFAIL to GFP_ATOMIC will not make any effect. > > Thank you for your explanation! Welcome. I wish all those gfp flags were really clear but I fully understand that people who are not working with MM regurarly might find it confusing. Btw. have __GFP_RETRY_MAYFAIL is documented in gfp.h and it is documented as the reclaim modifier which should imply that it has no effect when the reclaim is not allowed which is the case for any non sleeping allocation. If that relation was not immediately obvious then I think we need to make it explicit. Would you find it useful? E.g. diff --git a/include/linux/gfp.h b/include/linux/gfp.h index e3ab1c0d9140..8f09cefdfa7b 100644 --- a/include/linux/gfp.h +++ b/include/linux/gfp.h @@ -127,6 +127,8 @@ struct vm_area_struct; * * Reclaim modifiers * ~~~~~~~~~~~~~~~~~ + * Please note that all the folloging flags are only applicable to sleepable + * allocations (e.g. %GFP_NOWAIT and %GFP_ATOMIC will ignore them). * * %__GFP_IO can start physical IO. * -- Michal Hocko SUSE Labs