Message ID | 20200707093805.4775-1-sjpark@amazon.com (mailing list archive) |
---|---|
Headers | show
Return-Path: <SRS0=oiSc=AS=kvack.org=owner-linux-mm@kernel.org> Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BB9C013B4 for <patchwork-linux-mm@patchwork.kernel.org>; Tue, 7 Jul 2020 09:39:06 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 7BC98206DF for <patchwork-linux-mm@patchwork.kernel.org>; Tue, 7 Jul 2020 09:39:06 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=amazon.com header.i=@amazon.com header.b="id7IJ0wG" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7BC98206DF Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=amazon.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 7E3066B005C; Tue, 7 Jul 2020 05:39:05 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 796AA6B0062; Tue, 7 Jul 2020 05:39:05 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 680806B006C; Tue, 7 Jul 2020 05:39:05 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0065.hostedemail.com [216.40.44.65]) by kanga.kvack.org (Postfix) with ESMTP id 532016B005C for <linux-mm@kvack.org>; Tue, 7 Jul 2020 05:39:05 -0400 (EDT) Received: from smtpin10.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id CDB988248047 for <linux-mm@kvack.org>; Tue, 7 Jul 2020 09:39:04 +0000 (UTC) X-FDA: 77010781008.10.fact07_4200fcc26eb3 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin10.hostedemail.com (Postfix) with ESMTP id A3BCB16A046 for <linux-mm@kvack.org>; Tue, 7 Jul 2020 09:39:04 +0000 (UTC) X-Spam-Summary: 1,0,0,,d41d8cd98f00b204,prvs=45007d872=sjpark@amazon.com,,RULES_HIT:30001:30004:30012:30051:30054:30056:30064:30070:30075,0,RBL:207.171.184.29:@amazon.com:.lbl8.mailshell.net-66.10.201.10 62.18.0.100;04yfaxmyfpnuzycjej4k8s8qan1gfycooai741q6cjztgirdb56tkdopizn4rce.3ib7e96pyqm1gqtr6qwqyz41afb7ytabthtryjma7q1fmu7oi7yespd6p11dar1.r-lbl8.mailshell.net-223.238.255.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:neutral,Custom_rules:0:1:0,LFtime:24,LUA_SUMMARY:none X-HE-Tag: fact07_4200fcc26eb3 X-Filterd-Recvd-Size: 10973 Received: from smtp-fw-9102.amazon.com (smtp-fw-9102.amazon.com [207.171.184.29]) by imf11.hostedemail.com (Postfix) with ESMTP for <linux-mm@kvack.org>; Tue, 7 Jul 2020 09:39:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1594114744; x=1625650744; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=7QoswoiahhrG5EUF3hQrEfiZSC2O10x9Pf/apPsyVeg=; b=id7IJ0wGfEdCPEIE/ZfdWcg9pfltxlH36mlQcjeWUVm0FBVNO8sAnzE1 abGnESOPu2mOFIcCyhWRYg1KUBwUdCyebhetiRWYak6fGwXnzBBi4ISmf Oh5KI+1zMQcjPaSfgSCgPOCCkSP+Iy89uTbUGM8I2+1X99ZYdrtaohHH5 s=; IronPort-SDR: bOwZKzLi7B1NEq6k2ZvFULN0IhlnVpjZDjWC8tV+eJLExrwJMRFlGB1HxE++0/mtaetKNcYQvp WzrQTSHWeqwQ== X-IronPort-AV: E=Sophos;i="5.75,323,1589241600"; d="scan'208";a="57903384" Received: from sea32-co-svc-lb4-vlan3.sea.corp.amazon.com (HELO email-inbound-relay-1a-16acd5e0.us-east-1.amazon.com) ([10.47.23.38]) by smtp-border-fw-out-9102.sea19.amazon.com with ESMTP; 07 Jul 2020 09:38:55 +0000 Received: from EX13MTAUEA002.ant.amazon.com (iad55-ws-svc-p15-lb9-vlan2.iad.amazon.com [10.40.159.162]) by email-inbound-relay-1a-16acd5e0.us-east-1.amazon.com (Postfix) with ESMTPS id 5C143A1F80; Tue, 7 Jul 2020 09:38:43 +0000 (UTC) Received: from EX13D31EUA004.ant.amazon.com (10.43.165.161) by EX13MTAUEA002.ant.amazon.com (10.43.61.77) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 7 Jul 2020 09:38:42 +0000 Received: from u886c93fd17d25d.ant.amazon.com (10.43.161.203) by EX13D31EUA004.ant.amazon.com (10.43.165.161) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 7 Jul 2020 09:38:25 +0000 From: SeongJae Park <sjpark@amazon.com> To: <akpm@linux-foundation.org> CC: SeongJae Park <sjpark@amazon.de>, <Jonathan.Cameron@Huawei.com>, <aarcange@redhat.com>, <acme@kernel.org>, <alexander.shishkin@linux.intel.com>, <amit@kernel.org>, <benh@kernel.crashing.org>, <brendan.d.gregg@gmail.com>, <brendanhiggins@google.com>, <cai@lca.pw>, <colin.king@canonical.com>, <corbet@lwn.net>, <david@redhat.com>, <dwmw@amazon.com>, <foersleo@amazon.de>, <irogers@google.com>, <jolsa@redhat.com>, <kirill@shutemov.name>, <mark.rutland@arm.com>, <mgorman@suse.de>, <minchan@kernel.org>, <mingo@redhat.com>, <namhyung@kernel.org>, <peterz@infradead.org>, <rdunlap@infradead.org>, <riel@surriel.com>, <rientjes@google.com>, <rostedt@goodmis.org>, <rppt@kernel.org>, <sblbir@amazon.com>, <shakeelb@google.com>, <shuah@kernel.org>, <sj38.park@gmail.com>, <snu@amazon.de>, <vbabka@suse.cz>, <vdavydov.dev@gmail.com>, <yang.shi@linux.alibaba.com>, <ying.huang@intel.com>, <linux-damon@amazon.com>, <linux-mm@kvack.org>, <linux-doc@vger.kernel.org>, <linux-kernel@vger.kernel.org> Subject: [RFC v13 0/8] Implement Data Access Monitoring-based Memory Operation Schemes Date: Tue, 7 Jul 2020 11:37:57 +0200 Message-ID: <20200707093805.4775-1-sjpark@amazon.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" X-Originating-IP: [10.43.161.203] X-ClientProxiedBy: EX13D36UWA002.ant.amazon.com (10.43.160.24) To EX13D31EUA004.ant.amazon.com (10.43.165.161) X-Rspamd-Queue-Id: A3BCB16A046 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam03 Content-Transfer-Encoding: quoted-printable 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: <linux-mm.kvack.org> |
Series |
Implement Data Access Monitoring-based Memory Operation Schemes
|
expand
|
From: SeongJae Park <sjpark@amazon.de> Changes from Previous Version ============================= - Wordsmith the document, comment, commit messages - Support a scheme of max access count 0 - Use 'unsigned long' for (min|max)_sz_region Introduction ============ DAMON[1] can be used as a primitive for data access awared memory management optimizations. For that, users who want such optimizations should run DAMON, read the monitoring results, analyze it, plan a new memory management scheme, and apply the new scheme by themselves. Such efforts will be inevitable for some complicated optimizations. However, in many other cases, the users would simply want the system to apply a memory management action to a memory region of a specific size having a specific access frequency for a specific time. For example, "page out a memory region larger than 100 MiB keeping only rare accesses more than 2 minutes", or "Do not use THP for a memory region larger than 2 MiB rarely accessed for more than 1 seconds". This RFC patchset makes DAMON to handle such data access monitoring-based operation schemes. With this change, users can do the data access aware optimizations by simply specifying their schemes to DAMON. [1] https://lore.kernel.org/linux-mm/20200706115322.29598-1-sjpark@amazon.com/ Evaluations =========== We evaluated DAMON's overhead, monitoring quality and usefulness using 25 realistic workloads on my QEMU/KVM based virtual machine running a kernel that v12 of this patchset is applied. An experimental DAMON-based operation scheme for THP, ‘ethp’, removes 31.29% of THP memory overheads while preserving 60.64% of THP speedup. Another experimental DAMON-based ‘proactive reclamation’ implementation, ‘prcl’, reduces 87.95% of residential sets and 29.52% of system memory footprint while incurring only 2.15% runtime overhead in the best case (parsec3/freqmine). NOTE that the experimentail THP optimization and proactive reclamation are not for production, just only for proof of concepts. Please refer to the official document[1] or "Documentation/admin-guide/mm: Add a document for DAMON" patch in the latest DAMON patchset for detailed evaluation setup and results. [1] https://damonitor.github.io/doc/html/latest-damos More Information ================ We prepared a showcase web site[1] that you can get more information. There are - the official documentations[2], - the heatmap format dynamic access pattern of various realistic workloads for heap area[3], mmap()-ed area[4], and stack[5] area, - the dynamic working set size distribution[6] and chronological working set size changes[7], and - the latest performance test results[8]. [1] https://damonitor.github.io/_index [2] https://damonitor.github.io/doc/html/latest-damos [3] https://damonitor.github.io/test/result/visual/latest/rec.heatmap.0.html [4] https://damonitor.github.io/test/result/visual/latest/rec.heatmap.1.html [5] https://damonitor.github.io/test/result/visual/latest/rec.heatmap.2.html [6] https://damonitor.github.io/test/result/visual/latest/rec.wss_sz.html [7] https://damonitor.github.io/test/result/visual/latest/rec.wss_time.html [8] https://damonitor.github.io/test/result/perf/latest/html/index.html Baseline and Complete Git Tree ============================== The patches are based on the v5.7 plus v17 DAMON patchset[1] and Minchan's ``do_madvise()`` patch[2], which retrieved from the -next tree and slightly modified for backporting on v5.7. You can also clone the complete git tree: $ git clone git://github.com/sjp38/linux -b damos/rfc/v13 The web is also available: https://github.com/sjp38/linux/releases/tag/damos/rfc/v13 There are a couple of trees for entire DAMON patchset series that future features are included. The first one[3] contains the changes for latest release, while the other one[4] contains the changes for next release. [1] https://lore.kernel.org/linux-mm/20200706115322.29598-1-sjpark@amazon.com/ [2] https://lore.kernel.org/linux-mm/20200302193630.68771-2-minchan@kernel.org/ [3] https://github.com/sjp38/linux/tree/damon/master [4] https://github.com/sjp38/linux/tree/damon/next Sequence Of Patches =================== The 1st patch allows DAMON to reuse ``madvise()`` code for the actions. The 2nd patch accounts age of each region. The 3rd patch implements the handling of the schemes in DAMON and exports a kernel space programming interface for it. The 4th patch implements a debugfs interface for the privileged people and user programs. The 5th patch implements schemes statistics feature for easier tuning of the schemes and runtime access pattern analysis. The 6th patche adds selftests for these changes, and the 7th patch adds human friendly schemes support to the user space tool for DAMON. Finally, the 8th patch documents this new feature in the document. Patch History ============= Changes from RFC v12 (https://lore.kernel.org/linux-mm/20200616073828.16509-1-sjpark@amazon.com/) - Wordsmith the document, comment, commit messages - Support a scheme of max access count 0 - Use 'unsigned long' for (min|max)_sz_region Changes from RFC v11 (https://lore.kernel.org/linux-mm/20200609065320.12941-1-sjpark@amazon.com/) - Refine the commit messages (David Hildenbrand) - Clean up debugfs code Changes from RFC v10 (https://lore.kernel.org/linux-mm/20200603071138.8152-1-sjpark@amazon.com/) - Fix the wrong error handling for schemes debugfs file - Handle the schemes stats from the user space tool - Remove the schemes implementation plan from the document Changes from RFC v9 (https://lore.kernel.org/linux-mm/20200526075702.27339-1-sjpark@amazon.com/) - Rebase on v5.7 - Fix wrong comments and documents for schemes apply conditions Changes from RFC v8 (https://lore.kernel.org/linux-mm/20200512115343.27699-1-sjpark@amazon.com/) - Rewrite the document (Stefan Nuernberger) - Make 'damon_for_each_*' argument order consistent (Leonard Foerster) - Implement statistics for schemes - Avoid races between debugfs readers and writers - Reset age for only significant access frequency changes - Add kernel-doc comments in damon.h Please refer to RFC v8 for previous history SeongJae Park (8): mm/madvise: Export do_madvise() to external GPL modules mm/damon: Account age of target regions mm/damon: Implement data access monitoring-based operation schemes mm/damon/schemes: Implement a debugfs interface mm/damon/schemes: Implement statistics feature mm/damon/selftests: Add 'schemes' debugfs tests damon/tools: Support more human friendly 'schemes' control Documentation/admin-guide/mm: Document DAMON-based operation schemes Documentation/admin-guide/mm/damon/guide.rst | 41 ++- Documentation/admin-guide/mm/damon/plans.rst | 24 +- Documentation/admin-guide/mm/damon/start.rst | 11 + Documentation/admin-guide/mm/damon/usage.rst | 124 ++++++- include/linux/damon.h | 66 ++++ mm/damon.c | 344 +++++++++++++++++- mm/madvise.c | 1 + tools/damon/_convert_damos.py | 141 +++++++ tools/damon/_damon.py | 27 +- tools/damon/damo | 7 + tools/damon/schemes.py | 110 ++++++ .../testing/selftests/damon/debugfs_attrs.sh | 29 ++ 12 files changed, 880 insertions(+), 45 deletions(-) create mode 100755 tools/damon/_convert_damos.py create mode 100644 tools/damon/schemes.py