From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796018114; b=AGddDOsK6FYJ09p58DFUQz2Ddv3eM/I3RV/+N1F/kwbrZWYpWUHG8Y7a2wR0CoR1x7c5 GWWGhZcee+N2J5ZGrDiiiMWJ5HVSwOe0CTUPZceISqDv/QROO+IK3NGHD5eHl7hFqvEIr XOmPSPzsufz7o/gl4jqzsDA9c79L6I0VOfOlQxx+IYEMejmTrCBAAry33kGM89tR+07uQ Q9pqZaVAUCUzVlFm3BYzP3ErXUhfOkM49ZQXT8uzGkYv8JfC/ULugsmsUiF8LDE8/FmUK JxX9nuTNHvb3iZf7RRU5es/OGgdptipY00tb50JyL+Vt7uNFVRUp0Jqr3KNSDfokwow== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796018114; h=Received:DKIM-Signature:Date:To:From:In-Reply-To:References:Subject: Message-Id; bh=O2QvdnBdWAirkAOzScB4tOoQeK5TpHDXDP4MuAgMv0o=; b=rfYJdGU9a+askS5nHv1js2yC9eiz2ydKLO+yCLD75lxzE0FwYquLYhzFZbJ2Rxxpbvck jNLqx12ndzZwdAmH/OzV3V8TIoMUYdWeT1Q2C/tdp1yLbOa4iN8l9xZsqIF9KkQWtX+Ew ETpts61lu1K2ADvoeJdQj+vtQayYU4k2vKnKN+0fbopRE3x243yFlh51yHDiatcABIneE 0ciW6TVb8Hxv4eGc2nxG5rbnQu8CCGwilB3b2pkj9/KEgbdXnMOBmIzacmUvYTC7Ay42w zerpTrhKqoYT4Alzd7w9uH8LPqEhKWQbgeZkhQFriBopdq8ThY/BX4wdKjDvPO0OwVw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linux-foundation.org header.i=@linux-foundation.org header.a=rsa-sha256 header.s=korg header.b=sOrERN7U; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 22B97606A31C for ; Mon, 30 Nov 2026 05:55:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=linux-foundation.org header.i=@linux-foundation.org header.a=rsa-sha256 header.s=korg header.b=sOrERN7U Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7A23A1F00896; Mon, 30 Nov 2026 05:55:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=korg; t=1796018113; bh=O2QvdnBdWAirkAOzScB4tOoQeK5TpHDXDP4MuAgMv0o=; h=Date:To:From:In-Reply-To:References:Subject; b=sOrERN7UwGEu5hn7EXLIAKu0cTa2r6szfgUyZrzZrOfjIry7nPsNQ4yOOii5e24XI IIAdgkHwtsMtbPiDkcJR/CIzmAe1K8Ri3MCLu+2+9pHkn/k6+icCxfSyO1ST+IUbZ1 Y4o0gjp1zreAOPrjL6ehs0YbcZE2HRc5iTQbHMPA= Date: Sun, 29 Nov 2026 21:55:12 -0800 To: mm-commits@vger.kernel.org,ziy@nvidia.com,ying.huang@linux.alibaba.com, vbabka@kernel.org,surenb@google.com,shakeel.butt@linux.dev, ryan.roberts@arm.com,rppt@kernel.org,riel@surriel.com,pfalcato@suse.de, nico.pache@linux.dev,mhocko@suse.com,matthew.brost@intel.com,ljs@kernel.org, liam@infradead.org,lance.yang@linux.dev,kas@kernel.org, joshua.hahnjy@gmail.com,jannh@google.com,hannes@cmpxchg.org, gourry@gourry.net,dev.jain@arm.com,david@kernel.org,chris@chrisdown.name, byungchul@sk.com,baolin.wang@linux.alibaba.com,baohua@kernel.org, apopple@nvidia.com,usama.arif@linux.dev,akpm@linux-foundation.org From: Andrew Morton In-Reply-To: <20261125115014.4014507-2-usama.arif@linux.dev> References: <20261125115014.4014507-2-usama.arif@linux.dev> Subject: + fs-proc-task_mmu-read-the-pmd-once-in-smaps_pmd_entry.patch added to mm-new branch Message-Id: <20261130055513.7A23A1F00896@smtp.kernel.org> X-Mailing-List: mm-commits@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list The patch titled Subject: fs/proc/task_mmu: read the PMD once in smaps_pmd_entry() has been added to the -mm mm-new branch. Its filename is fs-proc-task_mmu-read-the-pmd-once-in-smaps_pmd_entry.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/fs-proc-task_mmu-read-the-pmd-once-in-smaps_pmd_entry.patch This patch will later appear in the mm-new branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm Note, mm-new is a provisional staging ground for work-in-progress patches, and acceptance into mm-new is a notification for others take notice and to finish up reviews. Please do not hesitate to respond to review feedback and post updated versions to replace or incrementally fixup patches in mm-new. The mm-new branch of mm.git is not included in linux-next If a few days of testing in mm-new is successful, the patch will me moved into mm.git's mm-unstable branch, which is included in linux-next Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next via various branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm and is updated there most days ------------------------------------------------------ From: Usama Arif Subject: fs/proc/task_mmu: read the PMD once in smaps_pmd_entry() Date: Wed, 25 Nov 2026 03:49:57 -0800 Patch series "fs/proc/task_mmu: smaps fixes for non-present and device-private PMDs", v4. This series contains two fixes for the smaps PMD path, plus the cleanup they build on. They were extracted from the work on PMD swap entries for anonymous THPs [1] and can be merged independently. 1. Read the PMD once in smaps_pmd_entry(), the way smaps_pte_entry() already does. No functional change. 2. Stop reading the accessed and dirty bits out of a non-present PMD in smaps, where they encode the softleaf entry rather than accessed/dirty state. 3. Account device-private PMDs using mapcounts in smaps, matching the PTE path. Shared mappings get proportional PSS, and exclusive mappings are counted as private. This patch (of 3): smaps_pmd_entry() dereferences the pmd pointer six times. Read it once into a local with pmdp_get(), the way smaps_pte_entry() already does with ptep_get(), so that every test sees the same value. No functional change intended. Link: https://lore.kernel.org/20261125115014.4014507-1-usama.arif@linux.dev Link: https://patch.msgid.link/20261125115014.4014507-2-usama.arif@linux.dev Signed-off-by: Usama Arif Signed-off-by: Andrew Morton Suggested-by: Kiryl Shutsemau (Meta) Reviewed-by: Lorenzo Stoakes (ARM) Reviewed-by: Zi Yan Reviewed-by: David Hildenbrand (Arm) Cc: Nico Pache Cc: Alistair Popple Cc: Byungchul Park Cc: Gregory Price Cc: Jann Horn Cc: Joshua Hahn Cc: Liam R. Howlett Cc: Matthew Brost Cc: Michal Hocko Cc: Pedro Falcato Cc: Mike Rapoport Cc: Suren Baghdasaryan Cc: Vlastimil Babka Cc: Ying Huang Cc: Johannes Weiner Cc: Rik van Riel Cc: Shakeel Butt Cc: Baolin Wang Cc: Ryan Roberts Cc: Dev Jain Cc: Barry Song Cc: Lance Yang Cc: Chris Down fs/proc/task_mmu.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) --- a/fs/proc/task_mmu.c~fs-proc-task_mmu-read-the-pmd-once-in-smaps_pmd_entry +++ a/fs/proc/task_mmu.c @@ -1022,14 +1022,15 @@ static void smaps_pmd_entry(pmd_t *pmd, struct page *page = NULL; bool present = false; struct folio *folio; + const pmd_t pmdval = pmdp_get(pmd); - if (pmd_none(*pmd)) + if (pmd_none(pmdval)) return; - if (pmd_present(*pmd)) { - page = vm_normal_page_pmd(vma, addr, *pmd); + if (pmd_present(pmdval)) { + page = vm_normal_page_pmd(vma, addr, pmdval); present = true; } else if (unlikely(thp_migration_supported())) { - const softleaf_t entry = softleaf_from_pmd(*pmd); + const softleaf_t entry = softleaf_from_pmd(pmdval); if (softleaf_has_pfn(entry)) page = softleaf_to_page(entry); @@ -1046,7 +1047,7 @@ static void smaps_pmd_entry(pmd_t *pmd, else mss->file_thp += HPAGE_PMD_SIZE; - smaps_account(mss, page, true, pmd_young(*pmd), pmd_dirty(*pmd), + smaps_account(mss, page, true, pmd_young(pmdval), pmd_dirty(pmdval), locked, present); } #else _ Patches currently in -mm which might be from usama.arif@linux.dev are mm-zswap-use-separate-compression-and-decompression-requests.patch mm-zswap-use-stack-requests-for-synchronous-decompression.patch fs-proc-task_mmu-read-the-pmd-once-in-smaps_pmd_entry.patch fs-proc-task_mmu-dont-read-young-dirty-from-a-non-present-pmd-in-smaps.patch fs-proc-task_mmu-account-device-private-pmds-as-present-in-smaps.patch