From nobody Sun Apr 5 21:18:43 2026 Received: from out30-119.freemail.mail.aliyun.com (out30-119.freemail.mail.aliyun.com [115.124.30.119]) (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 3584623D2A1 for ; Tue, 24 Feb 2026 02:12:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=115.124.30.119 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771899125; cv=none; b=qTTX2dJHUjqMfG0mnqNzu8p+RqNmYssTrvjOyKgWwiYVKqaclIcdC1kInWXE1VN0cF4ptpAXqK0crN9cI/KfDZdRkjiiqF63rc2dLbHb7K0oCJruBxasMvwvNS1WPu4qzp0oFRhqCCzRZnwX1Sub6NLGAh4aVjlwKXx7PdqzAeU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771899125; c=relaxed/simple; bh=NzrUhdU8YPVazVL4dxUvq99C4lBFUa7dxgdtNl6DTos=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Ms4+N9WmjazVKrC8dUmv9e1ERY1QBdesJAMLxdo1B8NeW3Uu0wzWFmQC8cpd9bVvUm0VABuz4qM8Gw4zm8zdbzzCy0NXIZguYisz2ojdJT+vDpZCjjnMH2UaSJDFh+iMYCfzdg+SciydZ/ZsGazLT/P/oMffARdZPW9dBFf4kGw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com; spf=pass smtp.mailfrom=linux.alibaba.com; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b=a2/bYma3; arc=none smtp.client-ip=115.124.30.119 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b="a2/bYma3" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1771899121; h=From:To:Subject:Date:Message-ID:MIME-Version; bh=5kr4nT2BT8PGK/D1Q43aMJ3TWsyAUzb25RqrNR5DsqQ=; b=a2/bYma3WyeIvTahhskJjyOEgQItNaGETH+sN8IF2O7a5Yz3DjcY2L26oV4HViLWXG7kB2GEAbi9ifLTP2k+ujzJycVkwOnd1yiLkTkzRb8brDRlIrbG5nSlaDJyn0e0JccghMf34gARxcUpnJccyoFwgHhfIKvDGPf5kUwQExI= Received: from localhost(mailfrom:baolin.wang@linux.alibaba.com fp:SMTPD_---0WzhpS27_1771898184 cluster:ay36) by smtp.aliyun-inc.com; Tue, 24 Feb 2026 09:56:25 +0800 From: Baolin Wang To: akpm@linux-foundation.org, david@kernel.org Cc: catalin.marinas@arm.com, will@kernel.org, lorenzo.stoakes@oracle.com, ryan.roberts@arm.com, Liam.Howlett@oracle.com, vbabka@suse.cz, rppt@kernel.org, surenb@google.com, mhocko@suse.com, riel@surriel.com, harry.yoo@oracle.com, jannh@google.com, willy@infradead.org, baohua@kernel.org, dev.jain@arm.com, axelrasmussen@google.com, yuanchu@google.com, weixugc@google.com, hannes@cmpxchg.org, zhengqi.arch@bytedance.com, shakeel.butt@linux.dev, baolin.wang@linux.alibaba.com, linux-mm@kvack.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/5] mm: rmap: add a ZONE_DEVICE folio warning in folio_referenced() Date: Tue, 24 Feb 2026 09:56:05 +0800 Message-ID: X-Mailer: git-send-email 2.47.3 In-Reply-To: References: 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" The folio_referenced() is used to test whether a folio was referenced during reclaim. Moreover, ZONE_DEVICE folios are controlled by their device driver, have a lifetime tied to that driver, and are never placed on the LRU list. That means we should never try to reclaim ZONE_DEVICE folios, so add a warn= ing to catch this unexpected behavior in folio_referenced() to avoid confusion, as discussed in the previous thread[1]. [1] https://lore.kernel.org/all/16fb7985-ec0f-4b56-91e7-404c5114f899@kernel= .org/ Signed-off-by: Baolin Wang Acked-by: David Hildenbrand (Arm) Reviewed-by: Alistair Popple --- mm/rmap.c | 1 + 1 file changed, 1 insertion(+) diff --git a/mm/rmap.c b/mm/rmap.c index bff8f222004e..be785dfc9336 100644 --- a/mm/rmap.c +++ b/mm/rmap.c @@ -1065,6 +1065,7 @@ int folio_referenced(struct folio *folio, int is_lock= ed, .invalid_vma =3D invalid_folio_referenced_vma, }; =20 + VM_WARN_ON_FOLIO(folio_is_zone_device(folio), folio); *vm_flags =3D 0; if (!pra.mapcount) return 0; --=20 2.47.3