From mboxrd@z Thu Jan 1 00:00:00 1970 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 60191EB64D0 for ; Tue, 13 Jun 2023 16:10:06 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C0E296B007B; Tue, 13 Jun 2023 12:10:05 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BBE036B007E; Tue, 13 Jun 2023 12:10:05 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A85346B0080; Tue, 13 Jun 2023 12:10:05 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 8FA2B6B007B for ; Tue, 13 Jun 2023 12:10:05 -0400 (EDT) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 5C2CEAFB67 for ; Tue, 13 Jun 2023 16:10:05 +0000 (UTC) X-FDA: 80898211170.08.35E50B3 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf14.hostedemail.com (Postfix) with ESMTP id 4113B100026 for ; Tue, 13 Jun 2023 16:10:02 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf14.hostedemail.com: domain of ryan.roberts@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=ryan.roberts@arm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1686672603; 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; bh=me9t2DCnKN+LukP5X6rqgsUNUvRgOZXBnl/uVsoThtM=; b=F6FpW5q0tc4J+YtaFUEkgthlCUcHY/IixKEmGwLfM2IdxdjYwYA19zEFzY9UxSXN1WtXrl gBtQ6aws0EIkiclE9M6ySGO7CYsjh+gyxUoLU5JHLsB626wMSfG/J5MJG8ZfE73a/CZasq 97XGOcmE4xuPdDAoHzrE1jIpdUUPpJ0= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf14.hostedemail.com: domain of ryan.roberts@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=ryan.roberts@arm.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1686672603; a=rsa-sha256; cv=none; b=EEpiT56aK4q44nTcuvjVKY1KYmQCR/VD6NdH/1GfRXAoMr+a6gU2Xym7LvplPbNcUSJ9H+ c4qpQ2v57pR2oQROfCTqm47mQMJSdHiFj1pZ6GLNjUEN57MCfG3YKuwulYGpnCZzQ9wjP1 UU6maKxLQ3c0qD8bGUqSNo+VvhghLfs= Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id F24661FB; Tue, 13 Jun 2023 09:10:46 -0700 (PDT) Received: from e125769.cambridge.arm.com (e125769.cambridge.arm.com [10.1.196.26]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id BAA7D3F5A1; Tue, 13 Jun 2023 09:10:00 -0700 (PDT) From: Ryan Roberts To: Jonathan Corbet , Andrew Morton , "Matthew Wilcox (Oracle)" , Yu Zhao Cc: Ryan Roberts , linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, linux-doc@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v1 0/2] Report on physically contiguous memory in smaps Date: Tue, 13 Jun 2023 17:09:48 +0100 Message-Id: <20230613160950.3554675-1-ryan.roberts@arm.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 4113B100026 X-Stat-Signature: sypqojha8wy3wu169rwmjfqtbsqyqkfy X-Rspam-User: X-HE-Tag: 1686672602-33620 X-HE-Meta: U2FsdGVkX1/ymxhrLZYCSDjMG27lAnF1QcqLOew4V2Y0EwRyGC3jxSn5QZq0GSloysRE1YIjMa/lXTqLZQXPhQ30wlolyWmxNr50sYOtVK6vs4QLpJH5AIiZRwFjnQ+aaVHucGmaouItP+m+c9SNnFM1v+/iWJNlstKeXuTaejWxO+lVNPQZrUcpOP9o3DqEHZxYHWQCrn+ijhsffd1xOJVtVn+mJZsDA4CnS6pX3f9pxnxpBiTGQ+AG42s3H3X89MTDB0qCIDluJzqSo2ED+BRL1A5lPpkO61UelrCDrQz8xkLa+rkKcp0MZT8vOev+VF/dhH/8vkTv1Fg6O2e+zNdHNw0IAcK1yU7iHtn/qHDEiOuoYeH64qUBG+mjHnGKKdMUD2yqXnT6IaW9YkAMFwla6Q7kKto54hX1RNWpmbOxGEJDiii/4y0TKYJldJZsTwmtavSUjOb4YIm7yQNc1F3r7vho1tSdtQ0jxae4vGyjZS6xsuV/kzkr50yY2Iob/PHnHyWNUi5rQlVDGCoEHIHY4opBX98LOACgfDFNhGy2Q8FcnIxaengmaLopfNQBlzrbjRJ9Ps5lVA2+wLqMwWPielrlZxu63sIevih1QKO3yB5+YcQoibC0uHAUnoG9AKy38kJ4Zk7pI66oxNMChPqON5jO1mRQaiRN727SH13IBIZSbsmdK642/YwvEWh3QmEiOVnVmwmgJXXt9qrkBBlREXnc0wsCs0fgNKJf+Gh2VKd9VwA74YrMCHcYx9czqL84yVm8MvKk8SEDS1fWhAQeGkp4//xYns0nnm+G64J5vEOtp0zTLZFk9UKIjEOdv6gnNpbpZ/wwqFC415l51J7IY79+8GFGDYGGY7YTV1DOyAgolOj+rn28hoQ16pkKamBbmDKYJB5V4TEnblL78VCuVl9jeOo/okYx/guyogEQwNtx2LkMoYxnxMe//YX2EnvLA+2Q3x8Sbh+Y1UK 9irKWXqB SUFwakvpzl4BeJ4EJ0v9hTY6UfMYZ/oVrzyLTo7QEmnHaVoTmfPk3jzhGRt1+ms2UuDoMFFT6lYyjfCK6G7oxPLFIgKuv6yiPBwug+vToip1ZaRgHY7eB8uHIcQ848a5/FhfqVqQdK0cwq7CHejlp/8IX5mQFwCHLOuhY 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: Hi All, I thought I would try my luck with this pair of patches... This series adds new entries to /proc/pid/smaps[_rollup] to report on physically contiguous runs of memory. The first patch reports on the sizes of the runs by binning into power-of-2 blocks and reporting how much memory is in which bin. The second patch reports on how much of the memory is contpte-mapped in the page table (this is a hint that arm64 supports to tell the HW that a range of ptes map physically contiguous memory). With filesystems now supporting large folios in the page cache, this provides a useful way to see what sizes are actually getting mapped. And with the prospect of large folios for anonymous memory and contpte mapping for conformant large folios on the horizon, this reporting will become useful to aid application performance optimization. Perhaps I should really be submitting these patches as part of my large anon folios and contpte sets (which I plan to post soon), but given this touches the user ABI, I thought it was sensible to post it early and separately to get feedback. It would specifically be good to get feedback on: - The exact set of new fields depend on the system that its being run on. Does this cause problem for compat? (specifically the bins are determined based on PAGE_SIZE and PMD_SIZE). - The ContPTEMapped field is effectively arm64-specific. What is the preferred way to handle arch-specific values if not here? The patches are based on mm-unstable (dd69ce3382a2). Some minor conflicts will need to be resolved if rebasing to Linus's tree. I have a branch at [1]. I've tested on Ampere Altra (arm64) only. [1] https://gitlab.arm.com/linux-arm/linux-rr/-/tree/features/granule_perf/folio_smap-lkml_v1 Thanks, Ryan Ryan Roberts (2): mm: /proc/pid/smaps: Report large folio mappings mm: /proc/pid/smaps: Report contpte mappings Documentation/filesystems/proc.rst | 31 +++++++ fs/proc/task_mmu.c | 134 ++++++++++++++++++++++++++++- 2 files changed, 161 insertions(+), 4 deletions(-) -- 2.25.1