From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pz2-f1.google.com (mail-pz2-f1.google.com [74.125.228.1]) (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 69E63357D10 for ; Tue, 7 Jul 2026 12:59:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.228.1 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783429184; cv=none; b=diBpLp/FKfgf/JlPExD8WUHx59ktf3JlTOeXiqsLWmWSEru7B7Uxr5EqBbaBioKU0fhOX8WyDzP6IdYknPERsg90BuR0JGvV0Bquc7NeW6oj4LTBmq2lq1kW3GtANyrodFO1JLocVQKcP+Fet10+GebFS4hkVcv/W1JfCuWgfgs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783429184; c=relaxed/simple; bh=Byg3OJZRe1xd79dRgn/Udm67f4fCX5ulQy5iFP2kz1w=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=YL8FKUcPU7uTZ2A3ib4846bno4pW91Rx9awJD2GAmEjjx8zI0QL13JwSywFAHLjnXgysLS4ja2qzRkF7TiPsUPJ8jgFmUWjLjHilSjCJ5hssPhf5Akvo3dtchl7Pu/EbPMhhr/eRSR/6+6EkWBojzjmesW4zx23mhjy0D6xWiPY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=qNhOG6bt; arc=none smtp.client-ip=74.125.228.1 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="qNhOG6bt" Received: by mail-pz2-f1.google.com with SMTP id 41be03b00d2f7-ca00ea47337so659493a12.0 for ; Tue, 07 Jul 2026 05:59:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1783429182; x=1784033982; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=bqawGs/D2kwMuaBURT3A7nHx9bziQ0g0fHDee9Yijoc=; b=qNhOG6btEnVV5WsdEiIwgo+aAL+1hfa6WhiDm4ke6TbV3DURfnen3QMEH604nRYYmt QLCI7MLvnUs5ntGQ1nmTm/lOVeOuPj1zu0Gc18UgJRee18GFhhYOzA5/LEbrEFThKUSl e0/Q8g1rtoEKcAlA8BrAP1nW4L+aTHTd+A9trPNz+/hCa16yQJATbe3l+63scjuaCnIm aZpkdsP50ATLDVqq2h9YM2RvMhmT8SzQzp7lql98C6i1fTP76zcPtSkQ5oqcIsvvFq4F Ts7Mk0/bvT6dbjg52g2KZnI/98WCvgRtFNTiL3DOlmI3flQOgL+/ji/+Qyv5tb57bmKr JmcA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783429182; x=1784033982; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=bqawGs/D2kwMuaBURT3A7nHx9bziQ0g0fHDee9Yijoc=; b=dsOJFn2GBOIRsTMh5fMUrUP8xLHKGFP3iHfKZkz/qx/yi1AGBMl3J8CVd2Kdq4P4Ot uqfJGW9CcALbdkGdcMfQBRrp29wv0kkHRG7nFD5zjX/JDfbjaGu9Vt8n0ic61iOsUtjZ 0kIIxj+rjhhvrNs/9Q5lkN5I1zVBhXvuHGUqf7Z0Ocp9ugJT3OHxazS0Vde5B3ZIzWWv XzDusnBhkB3Lsyt6Qt0+BCqPFq6zrlJWbHUqPzZMf62rroY3RtpP4sbd9JtLUYFcw8J2 +W6VW+w3ZhRzTpxNodcsI50GnED8WfKyhpSMI8emGj01Z7O+PgjftCYRaYm5UN5sW+WO Yv5Q== X-Forwarded-Encrypted: i=1; AHgh+RoYo7ZOm4TrT2BOPHFxuL2sCbCmML92dS0Ts+LyYUbF0Y4zYwTIbSKMXvQ3KdILdADnzpQA4CJeX+XzBio=@vger.kernel.org X-Gm-Message-State: AOJu0Yzx/bKMElhqEJfOxQjgBzodFvz/QoB1Lkhsukxc49ofVU4n5ftr /gjnfcFrRtT0eHS3eIwF32Dz6GrcJ/G0/L/LmGsie0fGrao5ilYt5uMv X-Gm-Gg: AfdE7ckpWXeWR4PFiDWcsiVJ72AK5sbyqsQim23V1MXmMJ5NptM9QVYr5/+vOXg5lVj x5Sh/HybT1PprtTWZ5yI6jiH9CFD8711KfKjWyAfg08Ltfjz3Uf7C/QXYMzL7WfjgVTxSa1F37T kAbbmSNP8UjFprqD8G/D9A9rP+baLQoERvh87yLriIAl4Kn+T5vH3MN28a5MR5XmUaYZbvZa/8E uQP9UWSJSb0E0n6m0ikc9xhz+IzPxkU+X0hwQCaq30Nb2YH9ViRpr25hiwdxNa8Ke83eraBcHNQ 8xn8l7oV3rAIsYnhnEypuqwmj9N7MPuGsH5b6I/v23BmRS3jwXhsVbXtLnYhmnJRH69fL1f81dy dWan4CANpT0q16Z9nd9ZFcbeGjD6t2SGJkJtc5aNfC8fI5KlquXffwLPd7+bc6RmlOK9jqUb+s1 2/sk+4MayTbzezTd0duS7KV25DPA== X-Received: by 2002:a05:6a00:859b:b0:848:32f5:4999 with SMTP id d2e1a72fcca58-84832f56f1dmr1523190b3a.30.1783429181654; Tue, 07 Jul 2026 05:59:41 -0700 (PDT) Received: from intel.company.local ([210.184.73.204]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-847f6b5e566sm5415983b3a.3.2026.07.07.05.59.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jul 2026 05:59:40 -0700 (PDT) From: Wandun Chen To: vbabka@kernel.org, david@kernel.org, rostedt@goodmis.org, mhiramat@kernel.org, Alexander.Krabler@kuka.com, hughd@google.com, fvdl@google.com, bigeasy@linutronix.de, linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-rt-devel@lists.linux.dev Cc: akpm@linux-foundation.org, surenb@google.com, mhocko@suse.com, jackmanb@google.com, hannes@cmpxchg.org, ziy@nvidia.com, ljs@kernel.org, riel@surriel.com, liam@infradead.org, harry@kernel.org, jannh@google.com, lance.yang@linux.dev, mathieu.desnoyers@efficios.com, matthew.brost@intel.com, joshua.hahnjy@gmail.com, rakie.kim@sk.com, byungchul@sk.com, gourry@gourry.net, ying.huang@linux.alibaba.com, apopple@nvidia.com, pfalcato@suse.de Subject: [PATCH v2 0/4] mm: honour compact_unevictable_allowed in mlock and CMA paths Date: Tue, 7 Jul 2026 20:59:21 +0800 Message-ID: <20260707125925.3725177-1-chenwandun1@gmail.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Wandun Chen vm.compact_unevictable_allowed=0 (the default on RT) is meant to keep compaction from touching unevictable folios. Several paths still migrate folios that are about to become unevictable, or in CMA regions, installing migration entries that a later access must wait on, then causing latency spikes on RT kernels. This series fixes those paths and adds a tracepoint for diagnosis. It is a rework of the RFC [1] per review feedback, mainly from Vlastimil. RFC --> v2: 1. On top of the isolate-path filtering, also filter by VM_LOCKED during the migration unmap step. 2. Make mlock/mlockall wait for in-flight migration entries, ensuring the folio is on the unevictable LRU before mlock[all] returns. 3. Dropped letting CMA migration take unevictable folios; instead migrate CMA folios out during mlock[all], avoiding migration at cma_alloc time. 4. Moved the tracepoint to the migration unmap path. [1] https://lore.kernel.org/lkml/20260604023812.3700316-1-chenwandun1@gmail.com/ Wandun Chen (4): mm/migrate: do not migrate folios mapped into VM_LOCKED VMAs under compaction mm/mlock: wait for migration to finish when mlocking a folio mm/migrate: add tracepoint for folios unmapped during migration mm/mlock: migrate folios out of CMA when mlocking a range include/linux/compaction.h | 6 ++ include/linux/rmap.h | 3 + include/trace/events/migrate.h | 29 +++++++ mm/compaction.c | 8 +- mm/migrate.c | 23 +++++- mm/mlock.c | 142 ++++++++++++++++++++++++++++++++- mm/rmap.c | 16 +++- 7 files changed, 216 insertions(+), 11 deletions(-) -- 2.43.0