From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qk1-f170.google.com (mail-qk1-f170.google.com [209.85.222.170]) (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 EF3E33D47A6 for ; Mon, 17 Aug 2026 22:08:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.170 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787004498; cv=none; b=JNF90mtiKyM26E3jhBNsSyxEuXigdsl01UdabiACMm3ICFIc//MOpDCjXPFgBmWuP6jHIM/P18up2v/kcKZka9QmuL6tJMD/kibKliOM6wwxC2uu8CgZPg14yjoW/VaEsSu5S3cMMsCgm400JXDMYqQ56N41sjOtS1LZAoKxcp4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787004498; c=relaxed/simple; bh=Ul5zjVEEJnkC5vf1msDaU8Ob6iu4OfPHVuTc+TiHmNY=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=Rs06Ucc8hhuO5bOgRqFcTrdswfJ+gYcUbjJqP8MH+amvnsBJc0xxNp3gNOGqGVoRFFjRGLZWXVubhn63GJO/RwOxwb2gZ8AX6qET/KpDVkboCKZ/hnVjHEkLA6QOeVyfLspQCabrsjcrIhyTwgTp+H1As0TrMKWN28GwSWjrMkQ= 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=RbSh+eXM; arc=none smtp.client-ip=209.85.222.170 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="RbSh+eXM" Received: by mail-qk1-f170.google.com with SMTP id af79cd13be357-936e393176fso126596985a.0 for ; Mon, 17 Aug 2026 15:08:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gourry.net; s=google; t=1787004496; x=1787609296; 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=WaMmOyr/e8hbHyUhtw1/fJWH2VLNaqO0DJDPfuneTJ4=; b=RbSh+eXMjKRdQ+cgGuwSI0I/RM/YGjlCFR/n3+ZeUz3XGwsvtJPnxhGOpI7F4Tec1T nwgXQQ03iwhBCvHW5Cm+nuqZ8p/bnkqnU7FQ6+4uzZBPuvF6/HuLY1Hz3OdkEgu5QWzC CeGbMHqia4t2g5rgebuCNqBKx4AOnyeJom56lb6LxVOunvxX21/klVvWQzBNj/R1YEpF wRVCaUKm8jsr0YFddQqUpgVvavfwLRn+wkcGXf/XuXwp1ll7SnxYgCw9fED4Zzwo7vg1 ZXFPiADmlxsGN92bQvNjGvkl4EYZ5pCwKdJm2t3/PcHmyTQdZb/drw3u69/UG96ddxCI UzOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787004496; x=1787609296; 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=WaMmOyr/e8hbHyUhtw1/fJWH2VLNaqO0DJDPfuneTJ4=; b=nkhsr6EPISJQAcKM4eVecoq5ulNje8r9dDHEZ7heYedjvZfk5t5u+bD8vP0x/7CPfy UPX938xHeZtQB1greIvrOIBxb7NPDgJzbeEPRaNnSd8PddEAM+H77OB7AC4KkhMbJQ3E GO8bby2dpfPok+U/e9cKuHBRtFHl7TgBPPuWI90bwxIyKq8tLW6v/KuacnrgqzhHHxXs hoX6U1EEyf/mrgx+//DCfLx2gusjGdgUshT/3bIT7vhaMkbwj/8NdFIJF9al/oig0YKb kpL6Z2FqWLjmzsVbcPJ9COrxFSWcHNG4l5ZBhkdAnXjZx/NN72ACwwUG8ZFFqKZ/8brZ HFcg== X-Gm-Message-State: AOJu0YzEpZR9wAV0AKwNIcjLaut6ofk16uptvWnIEUcgwBhfxELiQbuI SaUr8m4TOTllnZKfeKfRxPoDFOghmelMNbV3T9zIvZo6kh/NTDG+AKxL2nBxe7QmM+g= X-Gm-Gg: AR+sD13/Pku3Hvnh2P4O+aLvfxcoe3F8+VCAWj/mD0ux20HRxIDN+YmWiefxPVeJn4T VWz9vQ8no+9lC3q/7tydusmJ9oOAfB6NjCAb3fADS8l/ia458BnFPnerQqK+0CDeLw6lzBDB7cP E++rkyQfSccIQfqnDUDPSSOP8t9EBR89hwykjTgNKYpxq3iXIalFal0aOHRdcnqLuLP6VsstYlW YBkYP53Cm+hCTF+o6kRMQ+lzXOnM+RGunnRu6Mjq7sh9uswRHOJFnkD1m2RR9ARBkuM4QaHjKDB 5X1e/yOKBl9BmuR4dZxxrkdYbjs8f+2Kt7L5Iyc80mu6AuhSHPJNG4k+OXhvmSx+oUjdOB8vzAw F7Sn+57T3gS+c+Tcc3Y52CH5bVeCQeYQtwdrxCoQ+N7jvn/OeODPi5e1pbiT29c+D+mTNJUCfbb ZFoy2AD9Um46JmnsS2Iuta636/mMYOZ5oroD2cIPgTfWeqJESajZ6OOvSRyN97BB6P4zAxhJIqV hX00m4ZhtSDOR44hpIhwHdw3Pb2MCHdFjengYEVKSovLRkKjD4WToY= X-Received: by 2002:a05:620a:170f:b0:92e:603f:1f20 with SMTP id af79cd13be357-936d2145adamr2421836985a.2.1787004495789; Mon, 17 Aug 2026 15:08:15 -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.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Aug 2026 15:08:15 -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 Subject: [PATCH v2 0/3] mm: reject zone device folios in more folio walkers Date: Mon, 17 Aug 2026 18:08:07 -0400 Message-ID: <20260817220810.1175596-1-gourry@gourry.net> X-Mailer: git-send-email 2.55.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 Several LRU-oriented mm walkers resolve the folio backing a PMD entry (or a physical pfn) and then reclaim, age, migrate, or lazyfree it without ever checking for ZONE_DEVICE memory. This series adds missing folio_is_zone_device() rejections, matching the checks that comparable walkers already perform. - mm/huge_memory, mm/madvise: the !pmd_present branch above these sites only filters device-private entries (which are non-present). A present zone device PMD (e.g. device-coherent) would still reach the folio and be lazyfreed / aged / paged out. Add an explicit check. - mm/mempolicy: queue_folios_pmd() can see a present zone device PMD (e.g. device-coherent) and queue it for migration. No crash reproducer - this is a correctness/hardening cleanup found by inspection. All checks are placed after the folio is resolved and before it is acted upon, on paths that already hold the relevant page-table lock, so no locking or refcount changes are involved. Gregory Price (3): mm/huge_memory: skip zone device folios in madvise_free_huge_pmd() mm/madvise: skip zone device folios in cold/pageout PMD range mm/mempolicy: skip zone device folios when queueing folios mm/huge_memory.c | 4 ++++ mm/madvise.c | 3 +++ mm/mempolicy.c | 2 ++ 3 files changed, 9 insertions(+) --- v2 - drop hugetlb, move checks earlier in queue migration route - fixes tags for all 3 -- 2.53.0-Meta