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=-11.1 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 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 28E37C47423 for ; Tue, 29 Sep 2020 20:33:29 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 97FFD2076B for ; Tue, 29 Sep 2020 20:33:28 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="IvLWm6Sk" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 97FFD2076B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id C1F176B005C; Tue, 29 Sep 2020 16:33:27 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BCFB26B0062; Tue, 29 Sep 2020 16:33:27 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id ABD206B0068; Tue, 29 Sep 2020 16:33:27 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0042.hostedemail.com [216.40.44.42]) by kanga.kvack.org (Postfix) with ESMTP id 96DDB6B005C for ; Tue, 29 Sep 2020 16:33:27 -0400 (EDT) Received: from smtpin18.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 582E3180AD801 for ; Tue, 29 Sep 2020 20:33:27 +0000 (UTC) X-FDA: 77317249254.18.drug51_3d137942718d Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin18.hostedemail.com (Postfix) with ESMTP id 1548C10216E28 for ; Tue, 29 Sep 2020 20:33:26 +0000 (UTC) X-HE-Tag: drug51_3d137942718d X-Filterd-Recvd-Size: 5369 Received: from mail-lj1-f196.google.com (mail-lj1-f196.google.com [209.85.208.196]) by imf03.hostedemail.com (Postfix) with ESMTP for ; Tue, 29 Sep 2020 20:33:25 +0000 (UTC) Received: by mail-lj1-f196.google.com with SMTP id c2so5122033ljj.12 for ; Tue, 29 Sep 2020 13:33:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:date:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=gvr9bkV9VfhnMW3HOHElqYjzyELtn3Escgba9Lv3wB4=; b=IvLWm6Sk3UDxYamWD+QC1RyoEtAKae8tmfxhPqQbyrTuf34rqKZa0ViaAfRMD59bZk Ym6BCTn3agicCeKMruKL7OwwJwm2Y26Sn6RfbpjjH6fT+0eIvBLMqzD9KbBcIeiiH593 DpuU4kgLqzv4KONpx4ysc0wbR2sr0Rxq9d1jsFKXt58YIBIharjP+8ciForEt8nUYnh+ jBQu5yLJZBE2LeOBh7e72y6DjKdt4rYzzLVz9X16YZ8UvpT0zLXypUhBrtzMlom5V7ji ppLSTj/yhNrMznispvI+1T29Uef2tOE9lJP2JUuTFHVTzMJtK9gVfKdO/RuYIHLT1pVb OKgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:date:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=gvr9bkV9VfhnMW3HOHElqYjzyELtn3Escgba9Lv3wB4=; b=ALfNUahWPkWOpD5Y4HfvOoouUfZgeyFZ/6vHWqZbMpCwP2nk+IX2TEhktSlH9fW7rj qvAObw4VuCzYTBr/0PddzCmpDP/UT5Kc1PIHwNX5GToSEccEPYk07hmpsHPfewYeJre1 dElPU1YtplQoAw46cGGO4urQY0Qcd2HFWoAeuRJ7cM2AuGUz1TU7nQ2uOKiOcZTZLPfJ dg2TcThwzgJo0lVMkqiBSjABfUspCrLKYC0VrMmrVw1j6u+lu/CVHbhAEcG0yIVVZBcD qHdr8OhlQEFbmpNOSgpgmBWIX36Y/NbGDQxOldx6Y63vIdxo2T6UXnHju95L3Lqtyw+z Z+9w== X-Gm-Message-State: AOAM53063+vDO75hr3l+hRukDeqfnzWO7Q0dSYiiS1nBeBXrxFWvPN7R e2UW76Gx8sHNGDdS+e1TuQM= X-Google-Smtp-Source: ABdhPJzPqsZ5eSYthSF22DsMeOge+/quUwD3O+Ai2KE63ENbwhBXjbmzt8P/gBihg+lcuf/rAIt8Aw== X-Received: by 2002:a2e:3c04:: with SMTP id j4mr1773690lja.397.1601411604018; Tue, 29 Sep 2020 13:33:24 -0700 (PDT) Received: from pc636 (h5ef52e31.seluork.dyn.perspektivbredband.net. [94.245.46.49]) by smtp.gmail.com with ESMTPSA id p27sm3388115lfo.272.2020.09.29.13.33.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Sep 2020 13:33:23 -0700 (PDT) From: Uladzislau Rezki X-Google-Original-From: Uladzislau Rezki Date: Tue, 29 Sep 2020 22:33:21 +0200 To: Michal Hocko Cc: Andrew Morton , LKML , linux-mm@kvack.org, "Paul E. McKenney" , "Uladzislau Rezki (Sony)" , Thomas Gleixner , Michal Hocko Subject: Re: [PATCH] mm: clarify usage of GFP_ATOMIC in !preemptible contexts Message-ID: <20200929203321.GA11583@pc636> References: <20200929123010.5137-1-mhocko@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200929123010.5137-1-mhocko@kernel.org> User-Agent: Mutt/1.10.1 (2018-07-13) 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, Sep 29, 2020 at 02:30:10PM +0200, Michal Hocko wrote: > From: Michal Hocko > > There is a general understanding that GFP_ATOMIC/GFP_NOWAIT are > to be used from atomic contexts. E.g. from within a spin lock or from > the IRQ context. This is correct but there are some atomic contexts > where the above doesn't hold. One of them would be an NMI context. > Page allocator has never supported that and the general fear of this > context didn't let anybody to actually even try to use the allocator > there. Good, but let's be more specific about that. > > Another such a context, and that is where people seem to be more daring, > is raw_spin_lock. Mostly because it simply resembles regular spin lock > which is supported by the allocator and there is not any implementation > difference with !RT kernels in the first place. Be explicit that such > a context is not supported by the allocator. The underlying reason is > that zone->lock would have to become raw_spin_lock as well and that has > turned out to be a problem for RT > (http://lkml.kernel.org/r/87mu305c1w.fsf@nanos.tec.linutronix.de). > > Signed-off-by: Michal Hocko > --- > include/linux/gfp.h | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/include/linux/gfp.h b/include/linux/gfp.h > index 67a0774e080b..2e8370cf60c7 100644 > --- a/include/linux/gfp.h > +++ b/include/linux/gfp.h > @@ -238,7 +238,9 @@ struct vm_area_struct; > * %__GFP_FOO flags as necessary. > * > * %GFP_ATOMIC users can not sleep and need the allocation to succeed. A lower > - * watermark is applied to allow access to "atomic reserves" > + * watermark is applied to allow access to "atomic reserves". > + * The current implementation doesn't support NMI and few other strict > + * non-preemptive contexts (e.g. raw_spin_lock). The same applies to %GFP_NOWAIT. > * > * %GFP_KERNEL is typical for kernel-internal allocations. The caller requires > * %ZONE_NORMAL or a lower zone for direct access but can direct reclaim. > -- > 2.28.0 > Reviewed-by: Uladzislau Rezki