From patchwork Fri Jun 7 12:23:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 13689812 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id A1154C27C53 for ; Fri, 7 Jun 2024 12:24:08 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C60786B008A; Fri, 7 Jun 2024 08:24:07 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C10566B0092; Fri, 7 Jun 2024 08:24:07 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AD7AD6B0093; Fri, 7 Jun 2024 08:24:07 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 903516B008A for ; Fri, 7 Jun 2024 08:24:07 -0400 (EDT) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 1812BA1886 for ; Fri, 7 Jun 2024 12:24:07 +0000 (UTC) X-FDA: 82204009734.09.739D632 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf09.hostedemail.com (Postfix) with ESMTP id 78A52140019 for ; Fri, 7 Jun 2024 12:24:05 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=VMxmt5f1; spf=pass (imf09.hostedemail.com: domain of david@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=david@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1717763045; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:references:dkim-signature; bh=mojzlgdpLrUHGcctTDkSw39VJjaquUXWuvUjF8zPifU=; b=Vo2yyxHEuhseFLuKx23wTDWLKPnGtvMHeJu7bsRsIePgvU0/SqZW7ZjI/jDvBqVqJWn426 6qHTI4o4EsLCNKXOk4Jzx1SelvGXSW1q/r/M3z8LK/x8Wwo3SDquaq9d2QHSN7UYeAIBlj 21PteDrfjACt7A2zXuD5EnnIFrej3JU= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1717763045; a=rsa-sha256; cv=none; b=S17b7kbe+4ivVmxEMtBLphMdlLZsP4GXnqAOoJR7ZdPe+FhInG3U0FGWgKlcyBQEf3Tkbb nlJs2lpiXrApublfb4D2y07obipgmR3hp3C73Hup+rPNMGiO+lCYh0l9eDwMuaHMej/lBm dB1tVHhDj5rkYALa+K9quHlSOD+4czM= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=VMxmt5f1; spf=pass (imf09.hostedemail.com: domain of david@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=david@redhat.com; dmarc=pass (policy=none) header.from=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1717763044; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=mojzlgdpLrUHGcctTDkSw39VJjaquUXWuvUjF8zPifU=; b=VMxmt5f1fvEeE086F6O0DqLRtExmX3wsHS0rqTEO7GY5kjDkrd3euvWqywpmR0FEFrqRoJ 4M3BheUEeEeiQkxiT8aL/uBfx1UmythQZ5FFiROgGbt7b4LfIytWwFFdNpNbmS/DfkAtXX b35mBbUz3eaidMv1mtaSla0V6IjT3zY= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-297-qO0f5XSMMt2qQwX-QnqWqQ-1; Fri, 07 Jun 2024 08:24:01 -0400 X-MC-Unique: qO0f5XSMMt2qQwX-QnqWqQ-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id EBC63185A780; Fri, 7 Jun 2024 12:24:00 +0000 (UTC) Received: from t14s.fritz.box (unknown [10.39.192.109]) by smtp.corp.redhat.com (Postfix) with ESMTP id ABF24492BCD; Fri, 7 Jun 2024 12:23:58 +0000 (UTC) From: David Hildenbrand To: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org, linux-doc@vger.kernel.org, linux-fsdevel@vger.kernel.org, David Hildenbrand , Andrew Morton , Jonathan Corbet Subject: [PATCH v1 0/6] fs/proc: move page_mapcount() to fs/proc/internal.h Date: Fri, 7 Jun 2024 14:23:51 +0200 Message-ID: <20240607122357.115423-1-david@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.10 X-Rspam-User: X-Stat-Signature: afdppcikrtb8nwzu5zbsmeq79esz9qcc X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 78A52140019 X-HE-Tag: 1717763045-342179 X-HE-Meta: U2FsdGVkX19PSqWZ/p4/B1063UuhqAJQPADeoS8U5Actkv8vzpd/u/E+yGdHtGzaAzJ0+Ql94kuecN5KHFbTplMoVvWn920AM2kCpcvz6+g58K99CvxgsaFv0xAqtvfEMeRVnmYY3zVQW4CQIC4ailMuWCjtVMpn5g0u4FasnJBwgVJ5BzgqMALCs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/CML5hGsBMPGYaq3+5HY7ZwVRHzlCrrbIT4te0d+nqwWYVIsXLERUU918selXDXjg23YQ== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: 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. Cc: Andrew Morton Cc: Jonathan Corbet David Hildenbrand (6): fs/proc/task_mmu: indicate PM_FILE for PMD-mapped file THP fs/proc/task_mmu: don't indicate PM_MMAP_EXCLUSIVE without PM_PRESENT fs/proc/task_mmu: properly detect PM_MMAP_EXCLUSIVE per page of PMD-mapped THPs fs/proc/task_mmu: account non-present entries as "maybe shared, but no idea how often" fs/proc: move page_mapcount() to fs/proc/internal.h Documentation/admin-guide/mm/pagemap.rst: drop "Using pagemap to do something useful" Documentation/admin-guide/mm/pagemap.rst | 21 ----- fs/proc/internal.h | 33 ++++++++ fs/proc/page.c | 21 +++-- fs/proc/task_mmu.c | 102 +++++++++++++---------- include/linux/mm.h | 27 +----- 5 files changed, 104 insertions(+), 100 deletions(-) base-commit: 19b8422c5bd56fb5e7085995801c6543a98bda1f