From nobody Mon Jun 8 22:00:49 2026 Received: from out162-62-57-49.mail.qq.com (out162-62-57-49.mail.qq.com [162.62.57.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5B9D93D25DD for ; Tue, 26 May 2026 09:12:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=162.62.57.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779786779; cv=none; b=Q6Jh0sN70FDn/LhV7ZS37DFbHOnaWc3oCc7bTvmHexMQD7a36d98YmYkrVKpN/KDSJ0+fr5RoD3pQKlXfCJmUR7M3m/Oar93PqQW9mRuZ88t8gFQB8NIsMqon23la1JKEvvd+5bYhZL0ikmixjPgYGDHFxE+2m+Nm1ZKXD7ifzE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779786779; c=relaxed/simple; bh=MODweBu1h/8tgiGejmE6O4bxXkalQbjollz2fyxXrjk=; h=Message-ID:From:To:Cc:Subject:Date:MIME-Version; b=WW3z4NTHZ1ADLFpAbv1gZvzXxdTErF2T1dKTFhQfINkb8vm7ChlHtgu7+JM6BLzPc1BRUiIN15eUkiqLkUBsm+1a+jLbfaq0XjHzwcLSy+zhN5R9pAB8OvQbR5uwPY63nfUlCldy3X+rbUJpvYtHjjUPTvbxSU4KHBxNOZdKWIw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=qq.com; spf=pass smtp.mailfrom=qq.com; dkim=pass (1024-bit key) header.d=qq.com header.i=@qq.com header.b=ENKysW2J; arc=none smtp.client-ip=162.62.57.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=qq.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=qq.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=qq.com header.i=@qq.com header.b="ENKysW2J" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qq.com; s=s201512; t=1779786771; bh=kYC95vynjnM4IGsQJlQlT8YNYAk5IDR0cnGcY3STF3s=; h=From:To:Cc:Subject:Date; b=ENKysW2JJGd3Rf1Xm+yAVhKd/PUkuBsW6onSUHsJ2tWDeosArl0mBLF3qyHwvDRZW NW3rmOQkwEgnThKpzGZ3cv3bX9lwJ7DteusJo+35t9JnPakOhKawFxqa9PQyHc1qqs bp3944eNA8wDJ8dnDUX0ms5bwk3NMvFUuk9X3t2U= Received: from node68.. ([166.111.236.25]) by newxmesmtplogicsvrsza73-0.qq.com (NewEsmtp) with SMTP id 330274DE; Tue, 26 May 2026 17:12:48 +0800 X-QQ-mid: xmsmtpt1779786768tgr36cims Message-ID: X-QQ-XMAILINFO: OVFdYp27KdlJK1iwt3u4zCdnQFp6L5DnIot0YJZzUnTd/f6c9+Yddu0C2sFSdo 6dpOMm21GqnRqJETGIlqV0gp5Nhd4Q/UwsSdI999UIy1tDuE3ph0xz9CZmADx+3tjwEC1EU9Cot5 IC11RZ2dOlkOJuygoxrmJAiN97Y0RhXkuI2lZ4N7f9vWJPGC4poNFAi6+F/HHEg716pjyq7GOKRR dxF1g89yDh70CAgS9kz7BYa9jRmnQOxNYegvsbowCH6rS1nf5oS2dkTq1oHFM0mCgrMeNGHSTPcS Pq5IRGGpU0022E4eSf5Y3/9S0rfFu9oEYYSIoGrNgnJ5U4QqrbsJljRTEeO6gWeAG1EiwEFJVSRJ uUhe/WRoN4YzEahsoJuornUYVkazlITffIMOh/tqvJ0kqFI5MQpWNw2Xw4JTmkdMYe+Ewu8dWC9T O0L9jtT6BcO5I/HZuwqAW47/B4ixtmiN6Wfc6zbNBLXIHmkTOzhiMZr+KwtYm2t598SROuvNjQoX jszXjpWRmATseHZnMwlGmZf3Cw+af9ch3aZ7/VgJErAC8NK2dQiYJpXLZ8WKC4Q0NjykBceMUkBp nRf0bkMp5OXXRGETlttz06twGG+nZTzW/vXygDdaclFN528WDmkU9wd6QYYOD1mj1STzme9swin9 6glTzOFYNqjEKBlc3+nNOici5KXP2NxL+6DNrI/6VW2BROyM1pbJlUpugc8MIPXN0tQlf0JUqYQU mqwGwfovKYB1pwIdx9RpkPvb3cHGiM6Cj8mS7FH6yux8oY8blxTe/5gclxdRhQEbNvQey8JqaBZS JIxbfh4OT9RAa3Gxb7ePvs6yQbr0/Mz9+DRS5zNit4Tq1/XXBOFJKwytA3gexZhn/WsHePwolitu EQ1KI80LbsflcwJGHnc43UrNAXQAN/0McHM2F/SCo+X/mR4Qc7ZdKjUR1qY2WDW3ryI3+d3mbgqm wUSfCaPZse4oPD4d89Fl1X0n2z5EZyv3xYjtUb8faP1223Y0MqptYoGoJKd1z1LyhrMNscMDdnH3 bIFnZWZ/uwuh36L/ID X-QQ-XMRINFO: Nq+8W0+stu50tPAe92KXseR0ZZmBTk3gLg== From: fujunjie To: Andrew Morton Cc: Vlastimil Babka , Brendan Jackman , Johannes Weiner , Michal Hocko , Suren Baghdasaryan , Zi Yan , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH] mm/page_alloc: fix deferred compaction accounting Date: Tue, 26 May 2026 09:12:48 +0000 X-OQ-MSGID: <20260526091248.251711-1-fujunjie1@qq.com> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" COMPACT_DEFERRED means compaction did not start because past failures caused the zone to be deferred. try_to_compact_pages() returns the maximum result seen while walking the zonelist, so a final COMPACT_DEFERRED result means no later zone reported that compaction actually ran. __alloc_pages_direct_compact() skips COMPACTSTALL and COMPACTFAIL accounting when try_to_compact_pages() returns COMPACT_SKIPPED, but not when it returns COMPACT_DEFERRED. A deferred-only direct compaction attempt can therefore look like a stall, and then a failure if the allocation still cannot be satisfied. Treat COMPACT_DEFERRED like COMPACT_SKIPPED in this accounting path. If a later zone runs compaction and returns a result above COMPACT_DEFERRED, or compact_zone_order() reports COMPACT_SUCCESS for a captured page, the final result is not COMPACT_DEFERRED and the existing accounting still runs. Signed-off-by: fujunjie Reviewed-by: Vlastimil Babka (SUSE) --- mm/page_alloc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 23c7298d3be2..ddeb79fa12db 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -4161,7 +4161,8 @@ __alloc_pages_direct_compact(gfp_t gfp_mask, unsigned= int order, psi_memstall_leave(&pflags); delayacct_compact_end(); =20 - if (*compact_result =3D=3D COMPACT_SKIPPED) + if (*compact_result =3D=3D COMPACT_SKIPPED || + *compact_result =3D=3D COMPACT_DEFERRED) return NULL; /* * At least in one zone compaction wasn't deferred or skipped, so let's base-commit: e8c2f9fdadee7cbc75134dc463c1e0d856d6e5c7 --=20 2.34.1