Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1037581pxa; Thu, 20 Aug 2020 00:18:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw33zDLw1iZVYB65OvviDW1xFFudpLmWft++O9dljIFyhK0SVMszlag/vahuuuFvLfYYXDz X-Received: by 2002:a50:e004:: with SMTP id e4mr1597983edl.114.1597907927741; Thu, 20 Aug 2020 00:18:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597907927; cv=none; d=google.com; s=arc-20160816; b=rCXVXUyfAyvEKRJ6iX+WpUk/+H5vaYeR8H7lZGDiY2yIW5ZUTnbtU5JipS93RzwmHk em/MX7eDhXmADSQmo4I51MfZClqLnLDU9Ku/ixcWhTwFROXTAkmS+J6ZwkYz5UTR8Tjx mrFM2zfQxhiqv/FfCIbTbQ1ia44zj1YpYIrwkCuUJ/O/sJ+0jpefLN367TAF8oArlx7m s1DsJ5UyLOGxRvoUge9738tTKdYoKRyj7csURNWq7LAiCZH4k0S6HWOuBzcnY6MvhCC0 WcaLun8OgS9uZLkSm3AvaUuWyY+XKnk1x9LyFk9NxhcRHQPRk5EnhmyuPijRkZ3PVroD u3Ww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=W59BglKGXdUJkCj/066BuyTZwUlLWMs0tlr8zdLJoL8=; b=pEPqw3QANoBUPSqjsz9iz1kHJqA2NyY1vDrNuR8MjdLA2nBpeCLaj+8vVry+HEktOA ji7TgoXEWNNLd+vYrIlhht+8PTBmlFMATIEdyKCUTa9M5LhZqJeANFrhgK+0xgmLJevj bxvK6muqKwsXwhOzF8z1UrcqXXj8qQrBAFpNEdATcbLoGUE55SCKFyFlCHzjExwQ65tU 5YJWFxWCa/h9uKMQp4pPaIsytezuaNXGN0VpV7Beg0gImco14sFJpLQfpryhGzhRJjAv j+1XPl1erx38B5MA6bGL7+fhokA8sJycIOvo2Tx9wR6kMmZ70LTphn+FfrFiUv7KlLEj ozng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amazon.com header.s=amazon201209 header.b=PbD2YNA0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w25si746309ejy.124.2020.08.20.00.18.23; Thu, 20 Aug 2020 00:18:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@amazon.com header.s=amazon201209 header.b=PbD2YNA0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726701AbgHTHRf (ORCPT + 99 others); Thu, 20 Aug 2020 03:17:35 -0400 Received: from smtp-fw-9101.amazon.com ([207.171.184.25]:49458 "EHLO smtp-fw-9101.amazon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725798AbgHTHRe (ORCPT ); Thu, 20 Aug 2020 03:17:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1597907854; x=1629443854; h=from:to:cc:subject:date:message-id:in-reply-to: mime-version; bh=W59BglKGXdUJkCj/066BuyTZwUlLWMs0tlr8zdLJoL8=; b=PbD2YNA0eTQqkB7eWTrFtKw2n732tQdyFclOskO2CN37O3kNjlyEAagA iPBRNZnI7SlEy+/biHNcSALNpCrFLFgpDhgrndjUdEV0mUltYoG/sE7ko fL3bZoGq4bwTWftIQWrH45GpbsNPaiYseF00Zf5w6RdHwd3HkVLiX1U2d 8=; 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) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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