From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 E14E318455E; Tue, 30 Jul 2024 16:50:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722358241; cv=none; b=JSQ/s0iVpV0mDzaQK2BmMHQm6s98A3EJ4nC92odL3oDsSrf/j4nGTP9I3G1emWAtBdh5J6WlJ5DPecqv+WVfwG53Gmkp6d+YndjolRKNe2zQBhBFaAVXMkpsVJrRpmVbrHizaCRQI0EjMIrJLZb8HVWU0YV5ME5Q7a95xCIY1Vw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722358241; c=relaxed/simple; bh=lxzB9Ci9yK4N1+EqvyCk9AbmvHNCeP1NGtk2cSWfs34=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=DwEIvpUYkSTvlXZrj5iqqSbgRcEnAW9EN2Qf32kULPVNYkcPIXJ9Wn9lVL1UmXeC5So3iRIcxLS+/A+yeDKraiEN8St+rQnDiwME54KV0nWNf5AS4UJx68rqERt3ZmSLJ6GXajyPmq7f9HxGNrXhbmRUbWDsbHklloHIwyfJarg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=rJsWJxDD; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="rJsWJxDD" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 22EA6C32782; Tue, 30 Jul 2024 16:50:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1722358240; bh=lxzB9Ci9yK4N1+EqvyCk9AbmvHNCeP1NGtk2cSWfs34=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rJsWJxDDftZmvkccKr1EyKxa9M6l3d6D6Nr9RqeTnk4zbGYbLO2neL12qLuoHCO+6 BbmRmy6fmqgHAfbupzXLvMlXa6cd2YLuP6r/G50D+gvNnje5fIYsITE32L1oXgFoVX 28opmUXjMyRfl0NR4agjMVWwxu91xhXsY0DioOOU= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, David Hildenbrand , "Kirill A. Shutemov" , Lance Yang , Oscar Salvador , Jonathan Corbet , Alexey Dobriyan , Andrew Morton , Sasha Levin Subject: [PATCH 6.6 343/568] fs/proc/task_mmu: indicate PM_FILE for PMD-mapped file THP Date: Tue, 30 Jul 2024 17:47:30 +0200 Message-ID: <20240730151653.276108678@linuxfoundation.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240730151639.792277039@linuxfoundation.org> References: <20240730151639.792277039@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: David Hildenbrand [ Upstream commit 3f9f022e975d930709848a86a1c79775b0585202 ] Patch series "fs/proc: move page_mapcount() to fs/proc/internal.h". With all other page_mapcount() users in the tree gone, move page_mapcount() to fs/proc/internal.h, rename it and extend the documentation to prevent future (ab)use. ... of course, I find some issues while working on that code that I sort first ;) We'll now only end up calling page_mapcount() [now folio_precise_page_mapcount()] on pages mapped via present page table entries. Except for /proc/kpagecount, that still does questionable things, but we'll leave that legacy interface as is for now. Did a quick sanity check. Likely we would want some better selfestest for /proc/$/pagemap + smaps. I'll see if I can find some time to write some more. This patch (of 6): Looks like we never taught pagemap_pmd_range() about the existence of PMD-mapped file THPs. Seems to date back to the times when we first added support for non-anon THPs in the form of shmem THP. Link: https://lkml.kernel.org/r/20240607122357.115423-1-david@redhat.com Link: https://lkml.kernel.org/r/20240607122357.115423-2-david@redhat.com Signed-off-by: David Hildenbrand Fixes: 800d8c63b2e9 ("shmem: add huge pages support") Acked-by: Kirill A. Shutemov Reviewed-by: Lance Yang Reviewed-by: Oscar Salvador Cc: David Hildenbrand Cc: Jonathan Corbet Cc: Alexey Dobriyan Signed-off-by: Andrew Morton Signed-off-by: Sasha Levin --- fs/proc/task_mmu.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c index ac605f143762f..0f5c06b8bb342 100644 --- a/fs/proc/task_mmu.c +++ b/fs/proc/task_mmu.c @@ -1519,6 +1519,8 @@ static int pagemap_pmd_range(pmd_t *pmdp, unsigned long addr, unsigned long end, } #endif + if (page && !PageAnon(page)) + flags |= PM_FILE; if (page && !migration && page_mapcount(page) == 1) flags |= PM_MMAP_EXCLUSIVE; -- 2.43.0