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 637C21A6192; Tue, 30 Jul 2024 16:32:00 +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=1722357120; cv=none; b=STj+gP7FL5zMIme0cyODcLuSt1/zZ5KYZHLB7cQY4iTASzo+VEfJXnqpJHgY95ZOwRnu+5k5CgR42v5z9aDmn3cu4c4JUdKs86oDf/hH23iG8nZxR0jqt7DjhESon0w+F3X29EW96IqQfP3dbKIrcSTzchozZ/24nAwPrQpv6wY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722357120; c=relaxed/simple; bh=SIZxUNk42M6J6KljToRMe0efIYhbSK6qFKfRfi2iGFA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=bULbApj91BH/nPg4PMNb9kXQ0W4n2uECqXkmpR+GBe5BwxTGnrzoc/wwzstfAY7fcUKKbOHhRdDeNleRvsb9y3072YrwSs94VN7ptkF07qCrjihrBHqBU9hEpAy7pNqnd+0yMmo8KRstawPAoKyGlB5c6G2SKJPyAwyxi7s0isc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=Eja4nb+m; 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="Eja4nb+m" Received: by smtp.kernel.org (Postfix) with ESMTPSA id DF89BC32782; Tue, 30 Jul 2024 16:31:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1722357120; bh=SIZxUNk42M6J6KljToRMe0efIYhbSK6qFKfRfi2iGFA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Eja4nb+m5bSDHxiANpBfx4BAwY9GtPvCkCAfL0WoxLXjkZnzKxrkvzW23qq+yuzf4 vCGy4Uf2DsSfXSNKzqp51oDn0BeauTYuhyHjn1sGtYOBl5upVNcLUS/EwZ1EY773MK sV10C86xBWel/sJKIFy8G6mzF5fYC6Xt2bCqgjdQ= 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.1 260/440] fs/proc/task_mmu: indicate PM_FILE for PMD-mapped file THP Date: Tue, 30 Jul 2024 17:48:13 +0200 Message-ID: <20240730151625.997268965@linuxfoundation.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240730151615.753688326@linuxfoundation.org> References: <20240730151615.753688326@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.1-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 a954305fbc31b..484886cdd272c 100644 --- a/fs/proc/task_mmu.c +++ b/fs/proc/task_mmu.c @@ -1513,6 +1513,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