From patchwork Tue Sep 29 12:30:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Hocko X-Patchwork-Id: 11805733 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 86313112C for ; Tue, 29 Sep 2020 12:30:20 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 2BF3820848 for ; Tue, 29 Sep 2020 12:30:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2BF3820848 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 09D89900002; Tue, 29 Sep 2020 08:30:19 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 026996B0062; Tue, 29 Sep 2020 08:30:18 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E3167900002; Tue, 29 Sep 2020 08:30:18 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0005.hostedemail.com [216.40.44.5]) by kanga.kvack.org (Postfix) with ESMTP id C9DAA6B005D for ; Tue, 29 Sep 2020 08:30:18 -0400 (EDT) Received: from smtpin20.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 86748181AE866 for ; Tue, 29 Sep 2020 12:30:18 +0000 (UTC) X-FDA: 77316031716.20.car42_6101a2d2718a Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin20.hostedemail.com (Postfix) with ESMTP id 6E34E180C0609 for ; Tue, 29 Sep 2020 12:30:18 +0000 (UTC) X-Spam-Summary: 1,0,0,aafa2e0f75435090,d41d8cd98f00b204,mstsxfx@gmail.com,,RULES_HIT:41:355:379:541:800:960:967:973:988:989:1260:1263:1311:1314:1345:1437:1515:1534:1541:1711:1730:1747:1777:1792:2198:2199:2393:2525:2559:2563:2682:2685:2859:2901:2933:2937:2939:2942:2945:2947:2951:2954:3022:3138:3139:3140:3141:3142:3353:3865:3866:3867:3868:3870:3871:3872:3874:3934:3936:3938:3941:3944:3947:3950:3953:3956:3959:4250:4321:5007:6119:6261:7576:7903:7974:8599:9025:10004:11026:11257:11658:11914:12043:12297:12517:12519:12555:12679:12783:12895:13069:13161:13229:13311:13357:13894:14096:14181:14384:14394:14721:14849:21080:21433:21444:21451:21627:30054,0,RBL:209.85.208.65:@gmail.com:.lbl8.mailshell.net-62.18.84.100 66.100.201.100;04yg4nrqyaip5ah5bcnt5m7s5i9fkyci4nt7e9wse3yn4whb5rd8haufrokh5c8.cc57m7scn4h6p3rkurtbxtbtc4gwig74wbp7uofbft3am6sg7pwswugt4rbddbp.s-lbl8.mailshell.net-223.238.255.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:neutra l,Custom X-HE-Tag: car42_6101a2d2718a X-Filterd-Recvd-Size: 4216 Received: from mail-ed1-f65.google.com (mail-ed1-f65.google.com [209.85.208.65]) by imf23.hostedemail.com (Postfix) with ESMTP for ; Tue, 29 Sep 2020 12:30:17 +0000 (UTC) Received: by mail-ed1-f65.google.com with SMTP id i1so6147073edv.2 for ; Tue, 29 Sep 2020 05:30:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=5K1RsZycD7BnQ8mECakiQ/2HzkXZ73MXqfcF+5Rj0bo=; b=MUKLUhFXY6KxglJamjpwh/kKxqYZXOXheRoBfxwhFKY4oajemZvvvMk61TtwQ4+wDS MDWiI0/VG1khcVN47YFe6Z14jJkHm+8PxfVS+8Q/iyZImScvNIZnBzWSvOORO4ZQQA05 FOmiQA+Dx/GbFbhr8sb4z8v5APEecMy4mB8nwhh7tlWdF2mdlhUSd6gpnA4rzFtnVysf 07UwwzEx5OTASsxd3qpo3huON3+AwJxOVYrmQeS2pfZondbeVxszhhzZJbPX7Y2ynMVn 4MVbVDfnmjGfNYabwToRWegHjQTd74cHbUrze5AOqWc1h69xVDOnrKpNwL0mlkWbX0Qg 0Phg== X-Gm-Message-State: AOAM530pjBqouXokruWCZROxLvs3OI6j+oEckzUPA/OS/rsl4ZBej6/K gghDIyHH7Q+s9dK3rJfUTwQ= X-Google-Smtp-Source: ABdhPJx1UQvfenHa4EGvDQpqkY2w+8j7N45V2SRB3alkbRagkD9tkMPOaHYeOYcfUwDHVnNr9p1Cow== X-Received: by 2002:a05:6402:b9a:: with SMTP id cf26mr2852464edb.375.1601382616592; Tue, 29 Sep 2020 05:30:16 -0700 (PDT) Received: from tiehlicka.suse.cz (ip-37-188-253-123.eurotel.cz. [37.188.253.123]) by smtp.gmail.com with ESMTPSA id b20sm5389568ejv.9.2020.09.29.05.30.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Sep 2020 05:30:15 -0700 (PDT) From: Michal Hocko To: Andrew Morton Cc: LKML , , "Paul E. McKenney" , "Uladzislau Rezki (Sony)" , Thomas Gleixner , Michal Hocko Subject: [PATCH] mm: clarify usage of GFP_ATOMIC in !preemptible contexts Date: Tue, 29 Sep 2020 14:30:10 +0200 Message-Id: <20200929123010.5137-1-mhocko@kernel.org> X-Mailer: git-send-email 2.28.0 MIME-Version: 1.0 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: 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 Reviewed-by: David Hildenbrand Reviewed-by: Thomas Gleixner Reviewed-by: Uladzislau Rezki --- 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.