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 X-Spam-Level: X-Spam-Status: No, score=-9.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 08CA6C433E5 for ; Thu, 20 Aug 2020 07:17:37 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id BFCFF20786 for ; Thu, 20 Aug 2020 07:17:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=amazon.com header.i=@amazon.com header.b="JdHNCt7J" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BFCFF20786 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 43EE98D0008; Thu, 20 Aug 2020 03:17:36 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3C6E78D0003; Thu, 20 Aug 2020 03:17:36 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 23F6F8D0008; Thu, 20 Aug 2020 03:17:36 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0055.hostedemail.com [216.40.44.55]) by kanga.kvack.org (Postfix) with ESMTP id 089E38D0003 for ; Thu, 20 Aug 2020 03:17:36 -0400 (EDT) Received: from smtpin09.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id AE0F5180AD837 for ; Thu, 20 Aug 2020 07:17:35 +0000 (UTC) X-FDA: 77170091670.09.smell86_380c86b2702e Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin09.hostedemail.com (Postfix) with ESMTP id 895A4180AD81F for ; Thu, 20 Aug 2020 07:17:35 +0000 (UTC) X-HE-Tag: smell86_380c86b2702e X-Filterd-Recvd-Size: 6920 Received: from smtp-fw-9101.amazon.com (smtp-fw-9101.amazon.com [207.171.184.25]) by imf22.hostedemail.com (Postfix) with ESMTP for ; Thu, 20 Aug 2020 07:17:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1597907855; x=1629443855; h=from:to:cc:subject:date:message-id:in-reply-to: mime-version; bh=W59BglKGXdUJkCj/066BuyTZwUlLWMs0tlr8zdLJoL8=; b=JdHNCt7JcCipMEr4vhbeLOPXUduUoKjp+3oylmXLHPMQD9efYx1Nq4hV s/FHQp2cQ7r9XFHvGBtrIOBo/0KxLEcE83jk6zprSYIjUQrKzkMVt6Fkk Ukq1m/1jT0E4XkU6pfxlcyP/ArbgTapR1JW55L4z3ID673KVfqWqA971w w=; X-IronPort-AV: E=Sophos;i="5.76,332,1592870400"; d="scan'208";a="61201794" Received: from sea32-co-svc-lb4-vlan3.sea.corp.amazon.com (HELO email-inbound-relay-2a-90c42d1d.us-west-2.amazon.com) ([10.47.23.38]) by smtp-border-fw-out-9101.sea19.amazon.com with ESMTP; 20 Aug 2020 07:17:21 +0000 Received: from EX13MTAUEA001.ant.amazon.com (pdx4-ws-svc-p6-lb7-vlan3.pdx.amazon.com [10.170.41.166]) by email-inbound-relay-2a-90c42d1d.us-west-2.amazon.com (Postfix) with ESMTPS id B889BA222B; Thu, 20 Aug 2020 07:17:18 +0000 (UTC) Received: from EX13D31EUA001.ant.amazon.com (10.43.165.15) by EX13MTAUEA001.ant.amazon.com (10.43.61.82) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 20 Aug 2020 07:17:17 +0000 Received: from u3f2cd687b01c55.ant.amazon.com (10.43.162.38) by EX13D31EUA001.ant.amazon.com (10.43.165.15) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 20 Aug 2020 07:17:01 +0000 From: SeongJae Park To: Shakeel Butt CC: SeongJae Park , SeongJae Park , , Andrea Arcangeli , , , , , , Brendan Higgins , Qian Cai , Colin Ian King , Jonathan Corbet , "David Hildenbrand" , , "Du, Fan" , , Greg Thelen , Ian Rogers , , "Kirill A. Shutemov" , , Mel Gorman , Minchan Kim , Ingo Molnar , , "Peter Zijlstra (Intel)" , Randy Dunlap , Rik van Riel , David Rientjes , Steven Rostedt , , , , , , Vlastimil Babka , Vladimir Davydov , Yang Shi , Huang Ying , , , Linux MM , , LKML Subject: Re: [RFC v7 06/10] mm/damon: Implement callbacks for physical memory monitoring Date: Thu, 20 Aug 2020 09:16:47 +0200 Message-ID: <20200820071647.25280-1-sjpark@amazon.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.43.162.38] X-ClientProxiedBy: EX13D22UWB003.ant.amazon.com (10.43.161.76) To EX13D31EUA001.ant.amazon.com (10.43.165.15) X-Rspamd-Queue-Id: 895A4180AD81F X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam01 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: On Wed, 19 Aug 2020 17:26:15 -0700 Shakeel Butt wrote: > On Tue, Aug 18, 2020 at 12:27 AM SeongJae Park wrote: > > > > From: SeongJae Park > > > > This commit implements the four callbacks (->init_target_regions, > > ->update_target_regions, ->prepare_access_check, and ->check_accesses) > > for the basic access monitoring of the physical memory address space. > > By setting the callback pointers to point those, users can easily > > monitor the accesses to the physical memory. > > > > Internally, it uses the PTE Accessed bit, as similar to that of the > > virtual memory support. Also, it supports only user memory pages, as > > idle page tracking also does, for the same reason. If the monitoring > > target physical memory address range contains non-user memory pages, > > access check of the pages will do nothing but simply treat the pages as > > not accessed. > > > > Users who want to use other access check primitives and/or monitor the > > non-user memory regions could implement and use their own callbacks. > > > > Signed-off-by: SeongJae Park > [snip] > > +static void damon_phys_mkold(unsigned long paddr) > > +{ > > + struct page *page = damon_phys_get_page(PHYS_PFN(paddr)); > > + struct rmap_walk_control rwc = { > > + .rmap_one = damon_page_mkold, > > + .anon_lock = page_lock_anon_vma_read, > > + }; > > + bool need_lock; > > + > > + if (!page) > > + return; > > + > > + if (!page_mapped(page) || !page_rmapping(page)) > > + return; > > I don't think you want to skip the unmapped pages. The point of > physical address space monitoring was to include the monitoring of > unmapped pages, so, skipping them invalidates the underlying > motivation. I think my answer to your other mail[1] could be an answer to this. Let me quote some from it: ``` Technically speaking, this patchset introduces an implementation of DAMON's low level primitives for physical address space of LRU-listed pages. In other words, it is not designed for cgroups case. Also, please note that this patchset is only RFC, because it aims to only show the future plan of DAMON and get opinions about the concept before being serious. It will be serious only after the DAMON patchset is merged. Maybe I didn' made this point clear in the CV, sorry. I will state this clearly in the next spin. ``` ``` So, DAMON is a framework rather than a tool. Though it comes with basic applications using DAMON as a framework (e.g., the virtual address space low primitives implementation, DAMON debugfs interface, and the DAMON user space tool) that could be useful in simple use cases, you need to code your application on it if your use cases are out of the simple cases. I will also develop more of such applications for more use-cases, but it will be only after the framework is complete enough to be merged in the mainline. ``` Of course, we could prioritize the cgroup support if strongly required, though I still prefer focusing on the framework itself for now. [1] https://lore.kernel.org/linux-mm/20200820071052.24271-1-sjpark@amazon.com/ Thanks, SeongJae Park