Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796177922; b=GFBv+4kRFkBR8ve6YET0iZTaVb8SuCsg9iwFEgUIVEemvc24cRpx9OIMk+jtRYMBnvXF 5hxFqIGcSBrAhBKfePFo+F2LHeWtyzIbDiiIAfb27wvsQFU3rLYzoPy7Y5bV3vBN5UbQX LXFNHfyzaINmi/+qpzDPdyYreiYPSKa2IPNpkGF27zziDMBtZS6oQfF3JQWZq7vTU0EDZ v7qbj8ruVZpydmqnURZcJEHgcH5Gy1xZiKKF/kJIQM67VdGgBsEKqhmkf22B1YBPIuupW iAwegxlYUTJMKdzKnJ7Lci8IKjaHvCHK4WqlpqsXy16fa5n182u52ZHRKBmWDzhjUvA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796177922; h=Received:DKIM-Signature:Date:To:From:In-Reply-To:References:Subject: Message-Id; bh=xhawKp7jK+f+sehB8pCtgJiLJRxXs5gWACBkCdeiYYQ=; b=rb6iyrA6IAdrTPMIHVSzB+6CydTVoozOuAgiVMm4WHZ668S6OS6jIUvLC7yPjuN2uTkS JQu8804qO3XijdsEb2W20s7Xs1ul+i5QOXa9/bnmucpNZt/83nqoIRAVEwtplQlTkSzf8 ElHnM5yhnRrcUaryI7kmcMWHYMWQr0TjHlJZBQaKrvSNZwqg06u1oj1ZEuA53zgyxn00U mt0x1+0OIF3SWOmFRTvlRPRgj9PAaHAWyjgzqlHSZAda6f2D/ozZaaaKc/P+nZg+kXoDu BR9FI6oUIcefP5f1ffvH18yDCrW7/Es7PbqsedhlMFLhAs5r5NcaW6/Ln0XTYgdmAZg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linux-foundation.org header.i=@linux-foundation.org header.a=rsa-sha256 header.s=korg header.b=1+Uc3gkL; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3C776606A31A for ; Wed, 2 Dec 2026 02:18:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.a=rsa-sha256 header.s=korg header.b=1+Uc3gkL Received: by smtp.kernel.org (Postfix) with ESMTPSA id 93F4F1F000C1; Wed, 2 Dec 2026 02:18:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=korg; t=1796177921; bh=xhawKp7jK+f+sehB8pCtgJiLJRxXs5gWACBkCdeiYYQ=; h=Date:To:From:In-Reply-To:References:Subject; b=1+Uc3gkLpxZdBUfFZxLzE/MVJsCNEE5+ZKvxp7r8XrV3xPS74jiUaxBVlOFHcUHga w0yWadGFAWyPMoXtaYod+OI7Lw/Jg1yhJZpj34Q3yrZ5GxPaa1mT4RwVAdCud8CzvY s/NknJ/2FhvCJEWN1Vqm5a1w6XFEmwG4GHLUa90U= Date: Tue, 01 Dec 2026 18:18:41 -0800 To: mm-commits@vger.kernel.org,ziy@nvidia.com,vbabka@kernel.org, surenb@google.com,sj@kernel.org,mhocko@suse.com,mgorman@techsingularity.net, hannes@cmpxchg.org,dev.jain@arm.com,david@kernel.org, brendan.jackman@linux.dev,kas@kernel.org,akpm@linux-foundation.org From: Andrew Morton In-Reply-To: <20261116125746.2897395-1-kas@kernel.org> References: <20261116125746.2897395-1-kas@kernel.org> Subject: + mm-compaction-do-not-skip-the-free-scanners-periodic-lock-drop.patch added to mm-new branch Message-Id: <20261202021841.93F4F1F000C1@smtp.kernel.org> X-Mailing-List: mm-commits@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list The patch titled Subject: mm/compaction: do not skip the free scanner's periodic lock drop has been added to the -mm mm-new branch. Its filename is mm-compaction-do-not-skip-the-free-scanners-periodic-lock-drop.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-compaction-do-not-skip-the-free-scanners-periodic-lock-drop.patch This patch will later appear in the mm-new branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm Note, mm-new is a provisional staging ground for work-in-progress patches, and acceptance into mm-new is a notification for others take notice and to finish up reviews. Please do not hesitate to respond to review feedback and post updated versions to replace or incrementally fixup patches in mm-new. The mm-new branch of mm.git is not included in linux-next If a few days of testing in mm-new is successful, the patch will me moved into mm.git's mm-unstable branch, which is included in linux-next Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next via various branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm and is updated there most days ------------------------------------------------------ From: "Kiryl Shutsemau (Meta)" Subject: mm/compaction: do not skip the free scanner's periodic lock drop Date: Mon, 16 Nov 2026 12:57:45 +0000 isolate_freepages_block() drops zone->lock, checks for a fatal signal and calls cond_resched() at every pfn that is a multiple of COMPACT_CLUSTER_MAX. With a stride above one, the scan steps over a compound page, or over a high-order free page it has just isolated, to a pfn that is not a multiple of the stride. From there it never reaches a multiple of COMPACT_CLUSTER_MAX, so the rest of the pageblock is scanned without the check, possibly with zone->lock held and interrupts off. Count probes instead, and check every COMPACT_CLUSTER_MAX of them. Link: https://patch.msgid.link/20261116125746.2897395-1-kas@kernel.org Fixes: 4fca9730c51d ("mm, compaction: sample pageblocks for free pages") Signed-off-by: Kiryl Shutsemau (Meta) Signed-off-by: Andrew Morton Reviewed-by: SJ Park Reviewed-by: Dev Jain Reviewed-by: Zi Yan Cc: Vlastimil Babka Cc: Johannes Weiner Cc: David Hildenbrand Cc: Mel Gorman Cc: Suren Baghdasaryan Cc: Michal Hocko Cc: Brendan Jackman mm/compaction.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) --- a/mm/compaction.c~mm-compaction-do-not-skip-the-free-scanners-periodic-lock-drop +++ a/mm/compaction.c @@ -579,7 +579,7 @@ static unsigned long isolate_freepages_b unsigned int stride, bool strict) { - int nr_scanned = 0, total_isolated = 0; + int nr_scanned = 0, nr_probes = 0, total_isolated = 0; struct page *page; unsigned long flags = 0; bool locked = false; @@ -599,13 +599,15 @@ static unsigned long isolate_freepages_b /* * Periodically drop the lock (if held) regardless of its * contention, to give chance to IRQs. Abort if fatal signal - * pending. + * pending. Count probes rather than pfns, as the scan does not + * always land on a multiple of COMPACT_CLUSTER_MAX. */ - if (!(blockpfn % COMPACT_CLUSTER_MAX) - && compact_unlock_should_abort(&cc->zone->lock, flags, - &locked, cc)) + if (!(nr_probes % COMPACT_CLUSTER_MAX) && + compact_unlock_should_abort(&cc->zone->lock, flags, + &locked, cc)) break; + nr_probes++; nr_scanned++; /* _ Patches currently in -mm which might be from kas@kernel.org are mm-compaction-do-not-skip-the-free-scanners-periodic-lock-drop.patch