From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qk1-f178.google.com (mail-qk1-f178.google.com [209.85.222.178]) (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 6BE293E8340 for ; Mon, 17 Aug 2026 22:08:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.178 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787004504; cv=none; b=sFUavzn3sUVY6txqtPf/L0HC+S8YpsLeAUYajW8K3+uA4AfKvweZ7fdvwvsfyz+fuKQ81FCARuU0ED/1Wgq2rSPNTvP8mZHE5f7fPux2cBv1Z8Q8xnMwl7jw+G/SItfoCmK2rexRxQyPnwhqgCTWmx/0tOOPlnKr0MTKwMBDy7U= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787004504; c=relaxed/simple; bh=ZXtcW5Eoj+sECtsN1QOXnQk3JSNbUEnxSoGOx9uaKHU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=bq3E5dEr7S1hWP0rJq/7eqVDwAYs9xUFECUiV0oETxtrDRqXXUe70YHJpy9IDp7T8yFJ+2t6ZFsNZ+riHUg36Qqmj25tSEq7uBVHcg/a/cePWghMT8AJ2i986aJxE7/2lgpgZBy229K1GhJmWWm7mUnzaYseNFmoZT3WtGrrPzE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=gourry.net; spf=pass smtp.mailfrom=gourry.net; dkim=pass (2048-bit key) header.d=gourry.net header.i=@gourry.net header.b=VpoGboIi; arc=none smtp.client-ip=209.85.222.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=gourry.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gourry.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gourry.net header.i=@gourry.net header.b="VpoGboIi" Received: by mail-qk1-f178.google.com with SMTP id af79cd13be357-92ed3993c1eso208796585a.1 for ; Mon, 17 Aug 2026 15:08:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gourry.net; s=google; t=1787004501; x=1787609301; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=2oLjt6fqOYQqPl3RBDaIWJlYyCKzqU8AbAXeHyMH4wI=; b=VpoGboIi+7R5Ie1/wbOoaHqJMIL55HxwCaCS4HahyknzAvi6xPszqyjXfsS1QuDGhZ gP3UZyzzw/GMlCxZ9ugyO4+BEVvVgLd4Rs2nKbJTumMwREY4HzeH3Uod9EzEYvh/ms73 XkH6l01V0x5Q82Qcb/2yhO4binpt0DocmL0CuYBfoaAk1gbDUpvV3a7wCrhEGZfHzfAC Cs9JIKJHAGhUO4OhJeLiKmlBTmSNQloQxK/vWaWSpT7yjBm4nmAFkHmQm1IaI/zkmOGD WKsCqA/uMGpYyegc+tRv7xt6W1xyEyZQvDZEDBa8ICKWvQD3nF7/5C18vLuuG4PmU+Vk xQVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787004501; x=1787609301; h=content-transfer-encoding:mime-version:references:in-reply-to :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=2oLjt6fqOYQqPl3RBDaIWJlYyCKzqU8AbAXeHyMH4wI=; b=GvujAIhVCuX3HlcWNde4TnmEhKU9XitqMZaVpA+zY0nhHjmAvhZrT5cg9qMhykKGqm +THGx0XBskxPLd8YMEiGJhvkqm0QTuzGnIr9c0reBQw4fqe8osskombtJzlqSEVOqSS3 yF+GxwTzA2zgWSVU/IqonDV0Rnp3QfSGbU4B33kgxrhz1AdIilM0F3/llm19JjyzL2Bj 5s9/wsEQPF+AitAVftnajnLFn4lBcnlzPOooB3LDuYIird6wnIN3oPhnf+3EshVA7wnd fKc5XLBFY22nD2HAokE70SRZfeK1+d3SEGP8yvod6mzrrp8Fm7L102cYF+/+kGC4jUs9 8QpA== X-Gm-Message-State: AOJu0Yw3x85Gq9Tu96CKdwucSrwdwGNBrMCFYjum7D4OW1gm1parYEwi rA4Qt+MdxqIMGii4Ej8soSYNthr60atDH/jAXnxAWrammu5iK+iZowGk7hZaeml+tq4= X-Gm-Gg: AR+sD13rEqNSexPCeJFc6xDexFrFjP/WH94KMT9dTBqnxXSKDigI4jcrvuawzrg019Z i+/zX8uSCeRcy69eFdedbA4v2QGTDpNdNEI58WESKMweLvPDh0IU6TanQVcoefI6Z8/E8AHfaHV BBQ3zre8i+ljdRd7OzP+rAB45EKOjzJf2BsxaM6mrLx3YusrRE2tJqNapJdnWNFmMvznNoOiOFl a3GrLXuReroYe2Uht3Zf0467sAR6FQKC4M09aNioIcoKzm4kxS3/geZzRVge68mTwN+sBUKHqHX r3Xfas6p5IsmaAWIsOAPzUITfL/ZrWjoHQ8rYy7mQNHvKtYGhNrV0lr3WqOmkvOqaRzMA09cpkw IprKDSulB1imXQh7YenJzEKbB9FCgmnYvOQTLEJKE0kkD3mj49jvOg1KRluU7g9rrbI3xzBftK3 vUkhVtgLFeHzvsC0MyLxWQwbRbpOBtRFCQtHjW5zOHI+djXT8+zogSGb6xw55qCBSOqsp6mMHyo OX5VL8xrfLOcfSnGevMU3e//dxJT+YWVJpjVeG/QMy/3AUzb/i75VBbaWkzTA== X-Received: by 2002:a05:620a:2889:b0:92e:7cc9:a888 with SMTP id af79cd13be357-936d1fd98c4mr3001265785a.2.1787004501326; Mon, 17 Aug 2026 15:08:21 -0700 (PDT) Received: from gourry-fedora-PF4VCD3F.lan (pool-173-79-60-52.washdc.fios.verizon.net. [173.79.60.52]) by smtp.gmail.com with ESMTPSA id af79cd13be357-937033ce78csm147108885a.31.2026.08.17.15.08.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Aug 2026 15:08:21 -0700 (PDT) From: Gregory Price To: linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org, kernel-team@meta.com, akpm@linux-foundation.org, david@kernel.org, ljs@kernel.org, ziy@nvidia.com, baolin.wang@linux.alibaba.com, liam@infradead.org, nico.pache@linux.dev, ryan.roberts@arm.com, dev.jain@arm.com, baohua@kernel.org, lance.yang@linux.dev, usama.arif@linux.dev, vbabka@kernel.org, jannh@google.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, balbirs@nvidia.com, stable@vger.kernel.org Subject: [PATCH v2 3/3] mm/mempolicy: skip zone device folios when queueing folios Date: Mon, 17 Aug 2026 18:08:10 -0400 Message-ID: <20260817220810.1175596-4-gourry@gourry.net> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260817220810.1175596-1-gourry@gourry.net> References: <20260817220810.1175596-1-gourry@gourry.net> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit queue_folios_pte_range() already pairs vm_normal_folio() with an explicit folio_is_zone_device() check before adding folios to the migration pagelist. vm_normal_folio() alone does not reject zone device memory (a present device-coherent page in a normal VMA is returned as "normal"). Mirror the explicit check in queue_folios_pmd() as well. queue_folios_pmd() uses pmd_folio() directly and can encounter a present zone device PMD - e.g. a device-coherent THP. This is not filtered by existing checks: !pmd_present() - only rejects non-present device-private and migration entries vma_migratable() - excludes DAX and VM_PFNMAP. The early return also means such a folio is no longer counted in qp->nr_failed under MPOL_MF_STRICT. This is the same pattern used by queue_folios_pte_range() (skipping zone device without failing). Fixes: a30b48bf1b24 ("mm/migrate_device: implement THP migration of zone device pages") Cc: stable@vger.kernel.org Signed-off-by: Gregory Price (Meta) --- mm/mempolicy.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mm/mempolicy.c b/mm/mempolicy.c index 3498a5651d50f..3418b5664dcf8 100644 --- a/mm/mempolicy.c +++ b/mm/mempolicy.c @@ -662,6 +662,8 @@ static void queue_folios_pmd(pmd_t *pmd, struct mm_walk *walk) return; } folio = pmd_folio(pmdval); + if (folio_is_zone_device(folio)) + return; if (is_huge_zero_folio(folio)) { walk->action = ACTION_CONTINUE; return; -- 2.53.0-Meta