From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0C4261EFFB4 for ; Sun, 21 Dec 2025 20:43:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.130 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766349786; cv=none; b=iQV5TawzwfvkPXC+brD5Hu4/27TAUS2RXZHpgX8hUAkjqyjC1Qs7oIwr4i2KcoaVjeVIQJBHhr3kDNLXl7VD36qq6mCJA0y7IdbxStms+nUmX1Iwe2mwz+V8UvfLagihXN6e7SdO9sPhPmd1rfwZvIsVq2CBRtBrsyWad8fSEh0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766349786; c=relaxed/simple; bh=ITbuIQTyCBE+eyn/YIbDUKt+Af0tc3fjdiPex7DikD0=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=N38G1GKAvqNxrbmBXpzmlqJMwkWe5vkrMAa7YX6fPcBjgJ2BIG9kw1ugtZMmuyQCBPdVSHrLUK+9ZdsLtcpZAPZAt6f48S/9CdXfUyLoMrDbWlAAbKof7XuctWk2f/lMsfURh6P3xS7u0VJkpGAZfn5AVYSnzcilbsp3dPPAtI4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz; spf=pass smtp.mailfrom=suse.cz; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b=1kgWs9wn; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b=ufetOYAI; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b=ybEydBSI; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b=JCG4Sk/m; arc=none smtp.client-ip=195.135.223.130 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.cz Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b="1kgWs9wn"; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b="ufetOYAI"; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b="ybEydBSI"; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b="JCG4Sk/m" Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id F152133691; Sun, 21 Dec 2025 20:43:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1766349783; h=from:from:reply-to: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:autocrypt:autocrypt; bh=boLuaw1unK45fKbpB1XGKzYWrKDHJnzdks4RpU1QtjM=; b=1kgWs9wn2P21osXBHtWKd9GspxmejJnvmgZzf8I7m+rjBRgNvhGfYS0wt62iYjUFy+F+dl ctuOb4b6z9w7HwpUBSWeEw96w4XhuQ2inV+8FZKD42ohE2uI+TmpcHNdf1RrL6a/pxJFny voayzrFS13uLthYP3Z449oNt6f1xfgs= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1766349783; h=from:from:reply-to: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:autocrypt:autocrypt; bh=boLuaw1unK45fKbpB1XGKzYWrKDHJnzdks4RpU1QtjM=; b=ufetOYAItjNAy3Wrsia+pQAvvLmixoYRxoYaHlq+DJscQECQV1ZkRb/Zl+xrLxOH4yWH3A IrmJ+LCmb9HiVgBQ== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1766349782; h=from:from:reply-to: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:autocrypt:autocrypt; bh=boLuaw1unK45fKbpB1XGKzYWrKDHJnzdks4RpU1QtjM=; b=ybEydBSItQLF+A25xshpwpY7QWAg/3cl/uld7iSYlQuMaIvYYKBiPXyqYlXlo4DjVy1xzP aYw+wc0hl9x7Z+xK7vZwqipqr1sRwEDSKjdMVEG34Bp3dvMJXQnZmnBjnQg7Dnat9MKxxl ZVOlaXQNsnfcu5AW/JdVJj8VxZriO4g= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1766349782; h=from:from:reply-to: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:autocrypt:autocrypt; bh=boLuaw1unK45fKbpB1XGKzYWrKDHJnzdks4RpU1QtjM=; b=JCG4Sk/mDvYuZjFF4x+ofg27WtjuCwnydXVZ8r2ArG0JmohYD8QbqIJq/3kWFnz4MxVGBh vX4EiTJxV+Xs+BCA== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id C891413A54; Sun, 21 Dec 2025 20:43:02 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id ZvoiMNZbSGnnXAAAD6G6ig (envelope-from ); Sun, 21 Dec 2025 20:43:02 +0000 Message-ID: <9fcd1188-8ad7-4c7b-afd8-647d97b7aae1@suse.cz> Date: Sun, 21 Dec 2025 21:43:02 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] mm, page_alloc, thp: prevent reclaim for __GFP_THISNODE THP allocations To: Andrew Morton Cc: Suren Baghdasaryan , Michal Hocko , Brendan Jackman , Johannes Weiner , Zi Yan , David Rientjes , David Hildenbrand , Lorenzo Stoakes , "Liam R. Howlett" , Mike Rapoport , Joshua Hahn , Pedro Falcato , linux-mm@kvack.org, linux-kernel@vger.kernel.org References: <20251219-costly-noretry-thisnode-fix-v1-1-e1085a4a0c34@suse.cz> <20251220141601.e6694f904167bf12fa319a89@linux-foundation.org> Content-Language: en-US From: Vlastimil Babka Autocrypt: addr=vbabka@suse.cz; keydata= xsFNBFZdmxYBEADsw/SiUSjB0dM+vSh95UkgcHjzEVBlby/Fg+g42O7LAEkCYXi/vvq31JTB KxRWDHX0R2tgpFDXHnzZcQywawu8eSq0LxzxFNYMvtB7sV1pxYwej2qx9B75qW2plBs+7+YB 87tMFA+u+L4Z5xAzIimfLD5EKC56kJ1CsXlM8S/LHcmdD9Ctkn3trYDNnat0eoAcfPIP2OZ+ 9oe9IF/R28zmh0ifLXyJQQz5ofdj4bPf8ecEW0rhcqHfTD8k4yK0xxt3xW+6Exqp9n9bydiy tcSAw/TahjW6yrA+6JhSBv1v2tIm+itQc073zjSX8OFL51qQVzRFr7H2UQG33lw2QrvHRXqD Ot7ViKam7v0Ho9wEWiQOOZlHItOOXFphWb2yq3nzrKe45oWoSgkxKb97MVsQ+q2SYjJRBBH4 8qKhphADYxkIP6yut/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tCBYpLJM4ZYRpGZXne/FAtWNe4KbNJJqxMvrTOrnIatPj8NhBVI0RSJRsbilh6TE m6M14QORSWTLRg== In-Reply-To: <20251220141601.e6694f904167bf12fa319a89@linux-foundation.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[100.00%]; SUSPICIOUS_RECIPS(1.50)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-0.20)[-0.997]; MIME_GOOD(-0.10)[text/plain]; TAGGED_RCPT(0.00)[]; FUZZY_RATELIMITED(0.00)[rspamd.com]; MIME_TRACE(0.00)[0:+]; RCPT_COUNT_TWELVE(0.00)[15]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCVD_TLS_ALL(0.00)[]; FREEMAIL_ENVRCPT(0.00)[gmail.com]; TO_DN_SOME(0.00)[]; FROM_HAS_DN(0.00)[]; FREEMAIL_CC(0.00)[google.com,suse.com,cmpxchg.org,nvidia.com,kernel.org,oracle.com,gmail.com,suse.de,kvack.org,vger.kernel.org]; MID_RHS_MATCH_FROM(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DKIM_SIGNED(0.00)[suse.cz:s=susede2_rsa,suse.cz:s=susede2_ed25519]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,suse.cz:mid,suse.cz:email] X-Spam-Level: X-Spam-Flag: NO X-Spam-Score: -2.80 On 12/20/25 23:16, Andrew Morton wrote: > On Fri, 19 Dec 2025 17:31:57 +0100 Vlastimil Babka wrote: > >> Since commit cc638f329ef6 ("mm, thp: tweak reclaim/compaction effort of >> local-only and all-node allocations"), THP page fault allocations have >> settled on the following scheme (from the commit log): >> >> 1. local node only THP allocation with no reclaim, just compaction. >> 2. for madvised VMA's or when synchronous compaction is enabled always - THP >> allocation from any node with effort determined by global defrag setting >> and VMA madvise >> 3. fallback to base pages on any node >> >> Recent customer reports however revealed we have a gap in step 1 above. >> What we have seen is excessive reclaim due to THP page faults on a NUMA >> node that's close to its high watermark, while other nodes have plenty >> of free memory. >> >> The problem with step 1 is that it promises no reclaim after the >> compaction attempt, however reclaim is only avoided for certain >> compaction outcomes (deferred, or skipped due to insufficient free base >> pages), and not e.g. when compaction is actually performed but fails (we >> did see compact_fail vmstat counter increasing). >> >> THP page faults can therefore exhibit a zone_reclaim_mode-like behavior, >> which is not the intention. >> >> Thus add a check for __GFP_THISNODE that corresponds to this exact >> situation and prevents continuing with reclaim/compaction once the >> initial compaction attempt isn't successful in allocating the page. >> >> Note that commit cc638f329ef6 has not introduced this over-reclaim >> possibility; it appears to exist in some form since commit 2f0799a0ffc0 >> ("mm, thp: restore node-local hugepage allocations"). Followup commits >> b39d0ee2632d ("mm, page_alloc: avoid expensive reclaim when compaction >> may not succeed") and cc638f329ef6 have moved in the right direction, >> but left the abovementioned gap. > > Cool. What are your thoughts on which kernel version(s) should receive > this? We could just cc stable and let Fixes: do the job. Should be safe to backport.