From patchwork Tue Jun 13 16:09:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ryan Roberts X-Patchwork-Id: 10720 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp682931vqr; Tue, 13 Jun 2023 09:41:11 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7ZusHPOfUqFM6nZLJw3zWwPt+vI7OcO3WptjxxgOwnC9tA1bnWf+tiJWfhDMxSTgUfRbbr X-Received: by 2002:ac2:464a:0:b0:4f6:1160:b956 with SMTP id s10-20020ac2464a000000b004f61160b956mr5754020lfo.54.1686674471073; Tue, 13 Jun 2023 09:41:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686674471; cv=none; d=google.com; s=arc-20160816; b=AJLajgEslQwcIBTn2HmCnxdOtEfmBXF1ampF9xQKr40XVW+4njA0OsOi4xHbp+CvHQ hGK54HYxjr/avm8HgMQ4l0H4KLK8XUtVsTJF6U0Ouy4iZxeJSokBu6QAx/O4Wj9W4Xo0 F1nzuKS5n2maulSFwqK9Q9Lo91GdhBPrNwxd3UMrWdJBiTvbXXqQGxPwI9l+gNyybu+9 0uOGx2D1bMDaARXKtL/jokyeBV7WjiJTvIYIA8lfvHgxK+ZKDd9gpJc0SkD4QyP9jgqJ SqiPfJfIkoNr8evUeU5qRjIDcvHJFBP5RmDyqHxPdQkXd4taxCIrE2JtGXOnDSgdnzFP rqnA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=me9t2DCnKN+LukP5X6rqgsUNUvRgOZXBnl/uVsoThtM=; b=Tly33KZzRm5NJSy8Iw2R/8jMfYPirYa9nv3n2MO+Yp3pb0PwpJW/iBUKgYdyEVQCQz v4DTll0J3lJuspxMzLggR9fyQTBZHHS7xFfWkkyTnPz7P7i1BL6C9xHqerVLfv+EKkHA iV163FZxlgdcbHDR/gyB5aPqEjpWI3hgN0/bx8ZfaGP6uPEGiRfAGTr+gPTVi3BjeNks h0Qrm0bBjXatsXZVQhbabqpGjYAL0QeMNRpWVQ+d4MS4piPohkYyNqN9ytmPh2zinRdT Vn98x2CyboCLkRQFK1mNaWtZF+1kOfQK42Tiv8FBZGeEA2J8QTPwFrg2thwNQ/1wQIeo 5jtg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u6-20020a50eac6000000b00514b1c545d3si7719495edp.347.2023.06.13.09.40.46; Tue, 13 Jun 2023 09:41:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242945AbjFMQKP (ORCPT + 99 others); Tue, 13 Jun 2023 12:10:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40892 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243032AbjFMQKD (ORCPT ); Tue, 13 Jun 2023 12:10:03 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 875401981; Tue, 13 Jun 2023 09:10:02 -0700 (PDT) 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 X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768606370248138428?= X-GMAIL-MSGID: =?utf-8?q?1768606370248138428?= 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