From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 35E3E606A32F for ; Fri, 4 Dec 2026 09:30:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.a=rsa-sha256 header.s=google header.b=Nh+TBKfg Received: by kanga.kvack.org (Postfix) id 1E7806B05B9; Fri, 4 Dec 2026 04:29:59 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 1BE866B05BA; Fri, 4 Dec 2026 04:29:59 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0D52F6B05BB; Fri, 4 Dec 2026 04:29:59 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id CA5E56B05B9 for ; Fri, 4 Dec 2026 04:29:58 -0500 (EST) Received: from smtpin01.hostedemail.com (lb01a-stub [10.200.18.249]) by unirelay02.hostedemail.com (Postfix) with ESMTP id E82351202DB for ; Fri, 4 Dec 2026 09:29:57 +0000 (UTC) X-FDA: 85505778834.01.19FFD1D Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.47]) by imf24.hostedemail.com (Postfix) with ESMTP id D84A0180005 for ; Fri, 4 Dec 2026 09:29:55 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=suse.com header.s=google header.b=Nh+TBKfg; spf=pass (imf24.hostedemail.com: domain of mhocko@suse.com designates 209.85.128.47 as permitted sender) smtp.mailfrom=mhocko@suse.com; dmarc=pass (policy=quarantine) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; d=hostedemail.com; s=arc-20220608; cv=none; t=1796376596; b=HoN5QIkIWsruiip6uMmWvBtDAKWcu+uQ6qlXYrJnmTJ5BGA7v5LH/GPvAaM2fDp41JhNMY ouIVcaXsL8LRf4lmKKghI+V17M4ME2wGwFuGv2MVS67waj774bgmkifB4BGxwF/cvYmDnj 9z1ACyJWM7MuP0ucOOR7bHM9Q+dVt6M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1796376596; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=z92E7zJlq5ikuyz0dwm0FpXWDjDy3VNlv0Xv0erpNzM=; b=SIdgVlwB/0J8urqdXij5WfeTKEQw3/AUXDIuFwlQs/yjKxkOIAqiXSxdLktNl2MiyOB5o5 lHR6lkLAaOER/Yx4Tu1eKMzp4heb3cPMZConCraMvJ6pjA968qLphweMkzWNnYvrjkKLGY OUQm+ts4rCkCybyqO9zNrHTFlbGywTQ= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=suse.com header.s=google header.b=Nh+TBKfg; spf=pass (imf24.hostedemail.com: domain of mhocko@suse.com designates 209.85.128.47 as permitted sender) smtp.mailfrom=mhocko@suse.com; dmarc=pass (policy=quarantine) header.from=suse.com Received: by mail-wm1-f47.google.com with SMTP id 5b1f17b1804b1-4a5177d78c7so6691535e9.2 for ; Fri, 04 Dec 2026 01:29:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1796376594; x=1796981394; darn=kvack.org; h=in-reply-to:content-transfer-encoding:content-disposition :content-type:mime-version:references:message-id:subject:cc:to:from :date:from:to:cc:subject:date:message-id:reply-to:content-type; bh=z92E7zJlq5ikuyz0dwm0FpXWDjDy3VNlv0Xv0erpNzM=; b=Nh+TBKfg3tB5KSR67AYAqmwokYH6iQi+A25uw8AIF/ABysR+0btnrWB5PyU6ZVsyPm sH/oHZX4hixDDNARpyjtdvXIe8JqpiYhvSe2GJj7peXB0QP2taef1yJoGg7MFPWD+v7J owXiyxKlup1mf/tT6Pb6DbddM0nP8HttnaTkQgYGdIVW6AgsT1oVn6eOatWLlNkkNrSn BVDjHH1iOO1AIKy43QE+Ib5FZfqVlhZ9tHSlbtjbbUZM7x5XWRIjCwyrs7teYJLM7LP1 /6qH0i+8qFpfYv2gtnRtVu+rhDKlNBxo9uOufjAbpoCAuxanK+ZFB0qkbQNAqWjUcc60 2bgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796376594; x=1796981394; h=in-reply-to:content-transfer-encoding:content-disposition :content-type:mime-version:references:message-id:subject:cc:to:from :date:x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to:content-type; bh=z92E7zJlq5ikuyz0dwm0FpXWDjDy3VNlv0Xv0erpNzM=; b=Xlr9O7OoPtINUF7eqJnZRT93TLtW3NKMqqgSuBvHD/TEC4NDq227hErz85Jp0Q65To HH3rsysQeSFR6ociaXD6Zmiw5MEQXfCR66qUL/FsnonVaRGWDGxZeOVF7w64uzVOWtCc ux2VlN2R76amHcqmj2TClxJjPdbj9KTm342trf2fq50zu/yDupK8NyZc4UR+aDe30xjb wwnXCGOc0Ci45zJof74A5K+iFbxOVx0VzxB6eEv11THdH9+PplvntU9wRnPfNr1p6fuh dW9h4PdIMu1mpCP/q2Wvv/doBi+VtcOY1VP51uxLAN9hWWC4cDMkP/X87zsbKB5hUndJ 8FZQ== X-Forwarded-Encrypted: i=1; AL+hErHOmmGx/D4G895l07zcfa8VHgjBDO85iaAWKXAEEYf7Pv26ew4CoVw1I65ZJv7qRxGMbTJ2njcQtw==@kvack.org X-Gm-Message-State: APuU4Z9z/7WPJwH8e+P+14i6AGLRmSowQrqSDI3XkMg2q7V34ztbzpGe c6RvD0IkAGsHH0nKSiVRHJv88NPJ1wGhisHZwBMN8UPgnTgSrJhbjYqIohpDhjh9Kqw= X-Gm-Gg: AZFdTZdMTfaYmR1X5t1qSbHxUmjZLXfQ6DqUowVuVCzXEnnHDZwNEqtqYzUexqHETAj svYUU0aCRW1qiAGJptymDeOubMp9zacrO/wRFZIlsDG9bh1vyOmXk1p0X9fCFUjxRLqrVbmUo18 eodxZpvA3Y26I8z4Kmix3WXZ+eJlaLc6tpLTj5iya8+XOe/qwWAyHai/2+oBp2Kcjg0gnLZqu0e 9xhDaZvnHXowkERClLkq7J7KvnQdn9NPxJ99vRZGzJHADkgJfKjczLGJGcPxmi2Jh9g2c8/2JYe dDjzasDqypB9FXJPyaxFkmywJ3G+iJjEyPvBTIISN6fPyNVyL3gxcXHwhr3e7QCBoQKdIL9kaJk jGrze5XhRc7WAQ19DvmMDAxDkIKUvlWUFHvFj07cvmCIcLr4TRtwe4S3prQtalXTU3rsk1D/+O6 MiaIZFIk7Ducoj1I0em9TXpx/uGhVxkNK8LDeJqRuDu3mQx8WD+GlGTmssmgpTw60w+CsO0/17x 32layE62PCkDwIIoI97DwOylswUln+VoROkPK471T9nibRQbVH0EDK2ETMH+GCSYCUlFm7qsysp z2k0kXLbC/QjEgoIsOw5gr0qXCP3zpdkftnjORvUSg== X-Received: by 2002:a05:600c:6285:b0:4a2:1a:a116 with SMTP id 5b1f17b1804b1-4bbeb60138fmr23548625e9.0.1796376594270; Fri, 04 Dec 2026 01:29:54 -0800 (PST) Received: from localhost (109-81-27-207.rct.o2.cz. [109.81.27.207]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4bbeb6f0085sm30320175e9.4.2026.12.04.01.29.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Dec 2026 01:29:53 -0800 (PST) Date: Fri, 4 Dec 2026 10:29:52 +0100 From: Michal Hocko To: wangwensheng Cc: vbabka@kernel.org, hannes@cmpxchg.org, surenb@google.com, brendan.jackman@linux.dev, ziy@nvidia.com, akpm@linux-foundation.org, chrisl@kernel.org, kasong@tencent.com, shikemeng@huaweicloud.com, nphamcs@gmail.com, baoquan.he@linux.dev, baohua@kernel.org, youngjun.park@lge.com, david@kernel.org, linux-mm@kvack.org Subject: Re: [PATCH 2/2] mm/page_alloc: Move PF_MEMALLOC warning to nopage tag in the slowpath Message-ID: References: <20261203142306.468748-1-wsw9603@163.com> <20261203142306.468748-3-wsw9603@163.com> <6164d115-448b-4649-80f6-28480b123ac0@163.com> X-Archived-By: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <6164d115-448b-4649-80f6-28480b123ac0@163.com> X-Rspam-User: X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: D84A0180005 X-Stat-Signature: xn59cksnamegqo3c43k94s7yo66q77eb X-Spam-Status: No, score=-6.0 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_PASS,SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-HE-Tag: 1796376595-272770 X-HE-Meta: U2FsdGVkX1+w6T0Wz/MqSPw8gUMtRAj03MqlOX6ocxLoO22dQdLcHLex9HjBFKw7uI5i0z+75loRi+DFDPc+gQP8hEWO1el8PsztAoUbPL78AvZNVOI2vsUmVRjyxRkgKcIqn+n+thCEUxbg6v0GowZ/avOgAYX/ouRQHm0Wawr3bOYVFZpoPPSbYuqS04kE+ayslr9uQmpGUu1UDof+ET5GIBEv0uUCQ4qAN81HdKdht+7KNQhLvDMvifyMX54nNLqzz4be8zU+TBOMpwMYKaB3hya4T51U+2EcauLE2HaZl9LeAsLs+d5vt379XqaKFwovj3oYDiZQHQl0rGcw+YjxQVVLIQbvg+sycWpxAw9z5zBehvOzatNU52IemynkFFDlQhGJs1UK08SleZuuKX5Dp6QYORm+Jp34iDXd9oBhW+M9TXzorcp6werd2yEYzmU+WgPkZ4GSMsD3MoPPcfnpDbbvFRV8HP6S/rrybvUzUmG4jQCefBIOE2NQUFhAYq9uwVInFq3qE+miN8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QzaP4HtjXWBRrNl99lYgGgzcOQ== Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 On Fri 04-12-26 09:42:55, wangwensheng wrote: > > > On 12/4/26 01:24, Michal Hocko wrote: > > On Thu 03-12-26 22:23:06, Wang Wensheng wrote: > > > It is not uncommon to enter __alloc_pages_slowpath() with both > > > PF_MEMALLOC and __GFP_NOFAIL set during memory reclaim. The original > > > warning was placed where an allocation attempt had failed, intended to > > > alert about a potential silent stall: with PF_MEMALLOC, direct reclaim > > > cannot be performed, while __GFP_NOFAIL forces the allocation to keep > > > retrying. > > > > > > Commit 903edea6c53f ("mm: warn about illegal __GFP_NOFAIL usage in > > > a more appropriate location and manner") moved this warning to the > > > very start of __alloc_pages_slowpath(), before any allocation attempt. > > > This causes frequent false positives: PF_MEMALLOC allows allocations > > > to ignore watermarks, and the fastpath only checks the low watermark, > > > so the first allocation attempt inside the slowpath is likely to > > > succeed. > > > > So essentially you are telling that we shouldn't warn if the allocation > > just manages to succeeds because there are memory reserves available. > > While the intention of the code is to catch the unsupported GFP_NOFAIL > > use from the allocation context. See the difference? > > > > Am I right to understand that __GFP_NOFAIL must not be used together with > PF_MEMALLOC? In ext4, however, many memory allocation failures are hard to > handle gracefully. Meanwhile, PF_MEMALLOC is set within the reclaim path and > has no direct connection to ext4. This rule would therefore couple these two > subsystems, which seems difficult to adhere to. GFP_NOFAIL allocations from the memory reclaim context are simply broken! There is no way to guanratee any forward progress while being stuck in the page allocator which is blocking the reclaim. This is a dead lock scenario. See? > Besides, it does not make sense to emit warnings when user workloads remain > unaffected — I believe this should be a common understanding. Hence this > warning needs to be addressed. Do you have any alternative suggestions for > this scenario? Yes, do not require NOFAIL allocation from the memory reclaim path. Exactly what the warning tells you. > For additional context: this issue occurs on an embedded system. We have > very little free memory, the workload is stable with low memory usage > fluctuation. The same workload ran for a long time without trouble on older > kernels. On the new kernel, we only hit this warning rather than an OOM. THis is not about how much memory there really is. This is about a wrong memory allocation use. If the caller can handle allocation failure gracefully it shouldn't use NOFAIL in the first place. -- Michal Hocko SUSE Labs