From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qt1-f170.google.com (mail-qt1-f170.google.com [209.85.160.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 392F7233932 for ; Sun, 12 Jul 2026 12:39:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.170 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783859961; cv=none; b=pVIN6BZ7ZN5Bxka5jyBm/STC1MEMKHnZX09MSnbArSQmzndSLcNPl7YB1LacRF4g0opue1A3GjOSyfZ/2o61Bn62B+3huK20OecBP+lSEqpOxqTAEocYidVTppV4vK29H71u6mjN/QWeI+WbpR0Uagl/UHYK1ddlbSk1NhyZIbQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783859961; c=relaxed/simple; bh=+dukaAvtSE5JGlWs02PRixrf4baPDWdMwCbWnYTgd3Y=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=TDWQ/aGG9gcowG7uwgyI88khhVkEFwZ6uUYju/o9RmbK2DCEzmoL9Ql6UXKxdcQ+FUWTitgtFiQ2B4ipAReDhz/I6ZtHbrL6+d9c0d/cyuI3VSlvclKWLRvnmthzY5zgPtUEgkCKN0se4pq9T21yuP9Oy5U0Pggw/UFXHEm01aE= 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=fcXnFl9q; arc=none smtp.client-ip=209.85.160.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="fcXnFl9q" Received: by mail-qt1-f170.google.com with SMTP id d75a77b69052e-51c0c45c580so17356531cf.0 for ; Sun, 12 Jul 2026 05:39:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gourry.net; s=google; t=1783859959; x=1784464759; darn=vger.kernel.org; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=DpBJeAespB/ecG7leQANvH1JBf2dPPB4qbmO+Bd4+ZY=; b=fcXnFl9qvzafPG6HTkI95Pu5jbJlG/e1JNVtwJK62TLE3ksaZMinXAKTqWe2EDbPy9 qELrJfMx3dI5bgF9KKaSpX8Ohy9tIGRvBB9ffhEXjxlL5uPJ6Kby2OTFUXNDNh6UM3EG yYi865f16NaAeiIj5D5S6xXpV5EdkfVGZGrZuHa7MCTFV1ghHiOSRd9zJ6zIOkZC11UC H/+Ki26od/LdDfr4iCRVxe4iCks7MYMLq6oF1BR/rUUjdgwB98zVEncFsru5x2ytnLUW 2BAmXPDsjOFL0guKVO+/7yrPs/HPjP+NEq4TtsAC/cJ89Gb02BuYL6BRVo8r8it9M4pW 561w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783859959; x=1784464759; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=DpBJeAespB/ecG7leQANvH1JBf2dPPB4qbmO+Bd4+ZY=; b=BRTOAnRtWrXrgpOp5FQKiIb9AHLQxvgXOA+F0RMM21QGGJlG4PCSpGj4Kb9yPYVHyS ZX8lzqAYKwkNKA5w7Dc4jU+4/XtIyasR905sN/kOec0krtHR5bJiqBCTXpl+765jESec EuRmtwEYvka4R6W4dj7CPfp+yw2njWPtOvEYwVoMhpZqD03a6QUyihGG8Zfz2ysWHYWF HSeVb5FD+rvdWFPuSmLxdfn5uiQ1REYE2MIfIa4R2wec4LKShnks0d3vmGeQiT+cKutJ W7QAkJcnmu6QnS4k7LqTex6eUoiYLIMmAYRezNe9QTBrH31PgwRt03XXcLK9Dozo0ERk qdsw== X-Forwarded-Encrypted: i=1; AHgh+RoyGuhOvTPl0xcawoaWN/WyzPQaij4nCTTcg/KI3GJ4cHM264nHGpTZsnkdK4CF0KVHrzRaIEIMc4HMq38=@vger.kernel.org X-Gm-Message-State: AOJu0YyReft8q2pUihi/bqT8YkOQ0M59mum0qjQzy+0MvJ2qn1GDGvnb NEVzd+22MvCY7ZoeW15tOih4EsMGk6mIXE5M9JQLgSNXcI1rimTzmasNXU4NWxhyVk0= X-Gm-Gg: AfdE7cmldN8S+GmCHlGsNCY5DRG3n/r2wVVP/ys/s6Iu4Zukc42He4UDZpjG+n4VdWL QMRwhe+xP4ZRGxzv6XRKzdzlhf1v+gO8XhIXiJLsdVPLiLDRVZkE+FNa8kzuEzPiK8P6UCLViG3 O4aW2leqbi80+BxOCorMbHYykqg0voXz8y3dI+bDL/xHOuq1p2D6datnbmjR99BK9UQ+/n0EZFt OZSxhQsduwAgpcBcRdVT1oZMWeapmWfo5rMDUR8hU1YfK8VObuyJNZ8QeZG1A2i8MoBZ1unl/Nt JLTro04hSVy1LZzCFyyWtqBBW7iR7quxo3blDy8doNJUqcd+vNKuGun3O0Hz0LXI7RXgufa/KHf RnK39uiNsrcQ6SEBznti3uuO0HmLIgSRTpvqFU1WVnMUjOBnurHcntaPk/pLLlSAfDtf+u/yDCk f+zldCqG++JH4cWN46r4qY/5YVJ9HY6T177ZzBF5aIGDF/ZSbSznlg+jQkQH+91MrP1Q+q X-Received: by 2002:a05:622a:5c13:b0:51c:9b44:c59e with SMTP id d75a77b69052e-51cbf15fd9emr56444801cf.22.1783859959107; Sun, 12 Jul 2026 05:39:19 -0700 (PDT) Received: from gourry-fedora-PF4VCD3F (pool-173-79-60-52.washdc.fios.verizon.net. [173.79.60.52]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-8ffd5bbb1e1sm102900876d6.22.2026.07.12.05.39.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 Jul 2026 05:39:18 -0700 (PDT) Date: Sun, 12 Jul 2026 08:39:13 -0400 From: Gregory Price To: Usama Arif Cc: Andrew Morton , apopple@nvidia.com, balbirs@nvidia.com, baohua@kernel.org, baolin.wang@linux.alibaba.com, byungchul@sk.com, david@kernel.org, dev.jain@arm.com, jannh@google.com, joshua.hahnjy@gmail.com, lance.yang@linux.dev, liam@infradead.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, ljs@kernel.org, matthew.brost@intel.com, npache@redhat.com, rakie.kim@sk.com, ryan.roberts@arm.com, vbabka@kernel.org, ying.huang@linux.alibaba.com, ziy@nvidia.com, shakeel.butt@linux.dev, hannes@cmpxchg.org, sashiko-bot , stable@vger.kernel.org Subject: Re: [PATCH v3 1/3] mm/mempolicy: skip non-present PMDs when queueing folios Message-ID: References: <20260710105557.1987433-1-usama.arif@linux.dev> <20260710105557.1987433-2-usama.arif@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260710105557.1987433-2-usama.arif@linux.dev> On Fri, Jul 10, 2026 at 03:55:21AM -0700, Usama Arif wrote: > queue_folios_pmd() is called under pmd_trans_huge_lock(), whose > pmd_is_huge() check returns true for any non-present, non-none PMD > softleaf. Passing such a PMD to pmd_folio() treats the softleaf encoding > as a hardware PFN and can return a bogus folio pointer. > > Mirror queue_folios_pte_range(): handle non-present entries before > looking up a folio. Keep migration entries counted as failures, but skip > other non-present PMDs such as device-private entries. > > Potential trigger: an HMM-based GPU driver migrates an anonymous THP > folio to device memory via migrate_vma_pages(), leaving a device-private > PMD. Userspace then calls mbind(), migrate_pages() or > set_mempolicy_home_node() on that range. > > Reported-by: sashiko-bot > Link: https://sashiko.dev/#/patchset/20260703173903.3789516-1-usama.arif%40linux.dev?part=6 > Fixes: 368076f52ebe ("mm/huge_memory: add device-private THP support to PMD operations") > Cc: > Reviewed-by: Joshua Hahn > Reviewed-by: Zi Yan > Acked-by: David Hildenbrand (Arm) > Signed-off-by: Usama Arif Reviewed-by: Gregory Price