From patchwork Mon Feb 10 15:09:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 11373531 Return-Path: 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 ED2DA1395 for ; Mon, 10 Feb 2020 15:09:52 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id B9BF020714 for ; Mon, 10 Feb 2020 15:09:52 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=amazon.com header.i=@amazon.com header.b="BD8OqpaV" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B9BF020714 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 EC5AC6B011B; Mon, 10 Feb 2020 10:09:51 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id E76BE6B011D; Mon, 10 Feb 2020 10:09:51 -0500 (EST) 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 D3EEA6B011E; Mon, 10 Feb 2020 10:09:51 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0240.hostedemail.com [216.40.44.240]) by kanga.kvack.org (Postfix) with ESMTP id BB8EB6B011B for ; Mon, 10 Feb 2020 10:09:51 -0500 (EST) Received: from smtpin05.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 565DCA77C for ; Mon, 10 Feb 2020 15:09:51 +0000 (UTC) X-FDA: 76474552182.05.bread50_38d54db71b843 X-Spam-Summary: 1,0,0,,d41d8cd98f00b204,prvs=302a421da=sjpark@amazon.com,:akpm@linux-foundation.org:sjpark@amazon.de:acme@kernel.org:alexander.shishkin@linux.intel.com:amit@kernel.org:brendan.d.gregg@gmail.com:brendanhiggins@google.com:cai@lca.pw:colin.king@canonical.com:corbet@lwn.net:dwmw@amazon.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:rostedt@goodmis.org:sj38.park@gmail.com:vdavydov.dev@gmail.com::linux-doc@vger.kernel.org:linux-kernel@vger.kernel.org,RULES_HIT:30012:30051:30054:30064:30070,0,RBL:207.171.184.29:@amazon.com:.lbl8.mailshell.net-62.18.0.100 66.10.201.10,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:0:0,LFtime:23,LUA_SUMMARY:none X-HE-Tag: bread50_38d54db71b843 X-Filterd-Recvd-Size: 5433 Received: from smtp-fw-9102.amazon.com (smtp-fw-9102.amazon.com [207.171.184.29]) by imf37.hostedemail.com (Postfix) with ESMTP for ; Mon, 10 Feb 2020 15:09:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1581347391; x=1612883391; h=from:to:cc:subject:date:message-id:mime-version; bh=uz0PHbq7DEH/IUYLy7pPIh1qWdKpTQgKqzSb5AWn9T4=; b=BD8OqpaVofMkRbhd4WLDXBaeA+4+3gcY+w4GUj3tokm2KFfNqOk5ezSR O5Ss/KnwN4iP4mCZflqWAGVET8zegvFM9QjRYXiL/nRSpjx9N4W4UAVRt ecjXfwJGxypOMGbPAcGWR8XmrAN3qfR288JrrWC59hu/d81ugAQv6f73e s=; IronPort-SDR: sYvFWt3nq/N78/TWw0gmxAOkYtOGYnBHPYUgkIX1oLLq7I06B3AcWIEglic2qvGn60KQnMa2lj ypcYVEqOVxqQ== X-IronPort-AV: E=Sophos;i="5.70,425,1574121600"; d="scan'208";a="24101569" Received: from sea32-co-svc-lb4-vlan3.sea.corp.amazon.com (HELO email-inbound-relay-2a-119b4f96.us-west-2.amazon.com) ([10.47.23.38]) by smtp-border-fw-out-9102.sea19.amazon.com with ESMTP; 10 Feb 2020 15:09:49 +0000 Received: from EX13MTAUEA002.ant.amazon.com (pdx4-ws-svc-p6-lb7-vlan2.pdx.amazon.com [10.170.41.162]) by email-inbound-relay-2a-119b4f96.us-west-2.amazon.com (Postfix) with ESMTPS id 981821A0B10; Mon, 10 Feb 2020 15:09:47 +0000 (UTC) Received: from EX13D31EUA001.ant.amazon.com (10.43.165.15) by EX13MTAUEA002.ant.amazon.com (10.43.61.77) with Microsoft SMTP Server (TLS) id 15.0.1236.3; Mon, 10 Feb 2020 15:09:47 +0000 Received: from u886c93fd17d25d.ant.amazon.com (10.43.162.69) by EX13D31EUA001.ant.amazon.com (10.43.165.15) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Mon, 10 Feb 2020 15:09:35 +0000 From: To: CC: SeongJae Park , , , , , , , , , , , , , , , , , , , , , , , , Subject: [RFC PATCH 0/3] DAMON: Implement The Data Access Pattern Awared Memory Management Rules Date: Mon, 10 Feb 2020 16:09:18 +0100 Message-ID: <20200210150921.32482-1-sjpark@amazon.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 X-Originating-IP: [10.43.162.69] X-ClientProxiedBy: EX13D17UWB002.ant.amazon.com (10.43.161.141) To EX13D31EUA001.ant.amazon.com (10.43.165.15) 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: From: SeongJae Park DAMON can make data access pattern awared memory management optimizations much easier. That said, 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. It would not be too hard, but still require some level of efforts. Such efforts will be really necessary in some complicated cases. However, in many other cases, the optimizations would have a simple and common pattern. For example, the users would just want the system to apply an actions 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 but having a low access frequency more than 10 minutes", or "Use THP for a memory region larger than 2 MiB having a high access frequency for more than 2 seconds". This RFC patchset makes DAMON to receive and do such simple optimizations. All the things users need to do for such simple cases is only to specify their requests to DAMON in a form of rules. For the actions, current implementation supports only a few of ``madvise()`` hints, ``MADV_WILLNEED``, ``MADV_COLD``, ``MADV_PAGEOUT``, ``MADV_HUGEPAGE``, and ``MADV_NOHUGEPAGE``. Sequence Of Patches =================== The first patch allows DAMON to reuse ``madvise()`` code. The second patch implements the data access pattern awared memory management rules and its kernel space programming interface. Finally, the third patch implements a debugfs interface for privileged user space people and programs. The patches are based on the v5.5 plus v4 DAMON patchset[1] and Minchan's ``madvise()`` factoring out patch[2]. Minchan's patch was necessary for reuse of ``madvise()`` code. You can also clone the complete git tree: $ git clone git://github.com/sjp38/linux -b damon/rules/rfc/v1 The web is also available: https://github.com/sjp38/linux/releases/tag/damon/rules/rfc/v1 [1] https://lore.kernel.org/linux-mm/20200210144812.26845-1-sjpark@amazon.com/ [2] https://lore.kernel.org/linux-mm/20200128001641.5086-2-minchan@kernel.org/ SeongJae Park (3): mm/madvise: Export madvise_common() to mm internal code mm/damon/rules: Implement access pattern based management rules mm/damon/rules: Implement a debugfs interface include/linux/damon.h | 28 ++++ mm/damon.c | 317 +++++++++++++++++++++++++++++++++++++++++- mm/internal.h | 4 + mm/madvise.c | 2 +- 4 files changed, 346 insertions(+), 5 deletions(-)