Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3752846pxk; Tue, 29 Sep 2020 05:32:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwTCpVKga9X93Dvj6NaBoH5IPPPnvHCV1ddvr8qVPVV2ffF9TMKBysujwrUyQaD41uf4dEW X-Received: by 2002:a17:906:b285:: with SMTP id q5mr3553622ejz.545.1601382757268; Tue, 29 Sep 2020 05:32:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601382757; cv=none; d=google.com; s=arc-20160816; b=cd8QA+3IcKhfTMHkjT6M9K3G0oRh3LoZ40pddpUHM8qYVdtHZclixr9xMw/6PSG5wy 8ipG3O3V3ZZmHnjjGcsGXASZVLgFDCE6ZYN+1zEz4cHPWmi89hHvr0BrHRy7w4n0tPRq 9nqSa6x26XqC+o8r057VtM7YiGepihen/I6Kay+n9q89j63fQGVGuV5pp9RaWja5ecVS hPZfywfGkAf4/ahtuXFSjOWnUyReaOImrhAIF4yKg3in5Qngp00yT+fAnUPJTgH7nCSV oJuufeScfx77RVpbbq+jomDYExhIG2cg3HIiLz4HsA8WU9ciJgsqlNW65cz4TbBeRI9m +fkg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=5K1RsZycD7BnQ8mECakiQ/2HzkXZ73MXqfcF+5Rj0bo=; b=JT995RVN0oEWWH9hIe3bFHDW7X98+UqB14EQPWg81tpHnXFE7PEPXn+0mP77AUCx77 jkOxZ0r3HKzjaUHebA3eK1nQoKtf1Zrb6gq7k5FnDO1TjAWpbS8qyT9kJqjr6sIHMM82 2ccP9RvtJOJ5N4huFSov9UuDkpXVM8B9v7MvLdPXNPw13CIqFfE5Vh96wBrwKpERLVlj Ve0J4rN9JYJ/hISoPoQtlFR1ZrFzeIq53EcG/HChhsMoFtwBERaY/rNU7xLV3L8TSBSG vrtd5P6u//yqztMz2gzanPicpxpUDuxbzzPpJmTN3C0iInSuSBk+fI5PEQXR4DB0yNsG ISgw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id yd22si2943626ejb.546.2020.09.29.05.32.13; Tue, 29 Sep 2020 05:32:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732646AbgI2MbO (ORCPT + 99 others); Tue, 29 Sep 2020 08:31:14 -0400 Received: from mail-ed1-f66.google.com ([209.85.208.66]:42572 "EHLO mail-ed1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732799AbgI2MaS (ORCPT ); Tue, 29 Sep 2020 08:30:18 -0400 Received: by mail-ed1-f66.google.com with SMTP id j2so6117693eds.9 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=HFt5RdjD6i6vc6tkpxZ5d2DLIrB/OIAGVVkSencqLGlH68p4aro0SuuJan80uoiK13 PrnnoNiWccUITb/KXGstW776YLEPabeY9An3dktHnQLzTBRay8gkKJty3T0SGDGKcItL M2CtnZNQp87zjvvVavtL7RkKZGN0X3UweaWlT6+gOS910egjcInxORxtGmt9Lm6kwX2K nvUTENxDL4vjyMn5zQTMcZCtQtWbnT25DAEQ98MPr/HAh1ubv2+zfpt8ggeaVU/df8Tn xwT5NeOCoAReV1fEfdWbMsOMjPZlT6weme5Y4H5Ulw5fEkv6+rcqmxh+Ra0hMp+162Bg 5A1Q== X-Gm-Message-State: AOAM533F/tNIOM5ML6SL/ZOD7482mw2dP4PUEO1DadCYKRiHApzBKVaU HdiIqCA9GkFD9OT6nAoHZek= 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 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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