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.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,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 E9F9EC43461 for ; Thu, 17 Sep 2020 07:13:13 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 752D9208DB for ; Thu, 17 Sep 2020 07:13:13 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=amazon.com header.i=@amazon.com header.b="iOqYzDKK" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 752D9208DB 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 B179D6B0055; Thu, 17 Sep 2020 03:13:12 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id AC6836B005A; Thu, 17 Sep 2020 03:13:12 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9DCB56B005C; Thu, 17 Sep 2020 03:13:12 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0093.hostedemail.com [216.40.44.93]) by kanga.kvack.org (Postfix) with ESMTP id 88AD66B0055 for ; Thu, 17 Sep 2020 03:13:12 -0400 (EDT) Received: from smtpin30.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 49D47181AEF23 for ; Thu, 17 Sep 2020 07:13:12 +0000 (UTC) X-FDA: 77271687024.30.crowd25_590f9c727120 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin30.hostedemail.com (Postfix) with ESMTP id 29F5D180B31BC for ; Thu, 17 Sep 2020 07:13:05 +0000 (UTC) X-HE-Tag: crowd25_590f9c727120 X-Filterd-Recvd-Size: 7126 Received: from smtp-fw-4101.amazon.com (smtp-fw-4101.amazon.com [72.21.198.25]) by imf22.hostedemail.com (Postfix) with ESMTP for ; Thu, 17 Sep 2020 07:13:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1600326785; x=1631862785; h=from:to:cc:subject:date:message-id:in-reply-to: mime-version; bh=bT02fndMmz9E4+y+xqKPl+BUNHOX1Ddkk2I4qA/LheA=; b=iOqYzDKKbENVnSLY71h77Jgxr0XDNuRBnrSAjgkUPmg8LX98NYcJlgAw 8LHjG21k28HBwh1Bo2oOxTDiIluI8taAqLvTHMepmHAr0G/tiF4de1uxF E+3v6yTsnjC4mpADQKl9tae5p9Rw/kOjsamZWueDK0i4Ru+R1yH/ZSkNr c=; X-IronPort-AV: E=Sophos;i="5.76,436,1592870400"; d="scan'208";a="54591284" Received: from iad12-co-svc-p1-lb1-vlan3.amazon.com (HELO email-inbound-relay-2c-2225282c.us-west-2.amazon.com) ([10.43.8.6]) by smtp-border-fw-out-4101.iad4.amazon.com with ESMTP; 17 Sep 2020 07:13:01 +0000 Received: from EX13D31EUA004.ant.amazon.com (pdx4-ws-svc-p6-lb7-vlan3.pdx.amazon.com [10.170.41.166]) by email-inbound-relay-2c-2225282c.us-west-2.amazon.com (Postfix) with ESMTPS id 7EAABA18C7; Thu, 17 Sep 2020 07:12:57 +0000 (UTC) Received: from u3f2cd687b01c55.ant.amazon.com (10.43.161.71) by EX13D31EUA004.ant.amazon.com (10.43.165.161) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 17 Sep 2020 07:12:39 +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" , , Marco Elver , "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 PATCH 2/2] mm/damon/debugfs: Support multiple contexts Date: Thu, 17 Sep 2020 09:12:23 +0200 Message-ID: <20200917071224.3939-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.161.71] X-ClientProxiedBy: EX13D40UWC001.ant.amazon.com (10.43.162.149) To EX13D31EUA004.ant.amazon.com (10.43.165.161) X-Rspamd-Queue-Id: 29F5D180B31BC 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, 16 Sep 2020 09:11:18 -0700 Shakeel Butt wrote: > On Tue, Sep 15, 2020 at 11:03 AM SeongJae Park wrote: > > > > From: SeongJae Park > > > > DAMON allows the programming interface users to run monitoring with > > multiple contexts. This could be useful in some cases. For example, if > > someone want to do highly accurate monitoring and lots of CPUs are > > available, splitting the monitoring target regions into multiple small > > regions and allocating context (monitoring thread) to each small region > > could be helpful. Or, someone could need to monitor different types of > > address spaces simultaneously. > > > > However, it's impossible from the user space because the DAMON debugfs > > interface supports only single context. This commit makes it available > > by implementing 'nr_contexts' debugfs file. > > > > Users can pass the number (N) of contexts they want to use to the file. > > Why not just mkdir which will create a new context? Because I referenced the naming rule of zram and because I just wanted to make this as simple as possible. I find no special functional difference between current way and you suggested way. That said, I also think you suggested way is much more flexible. I will try to make this in that way. > > > Then, N folders having name of 'ctx<1-(N-1)>' are created in the DAMON > > debugfs dir. Each of the directory is associated with the contexts and > > contains the the files for context setting (attrs, init_regions, record, > > schemes, and target_ids). > > Also instead of naming the kthread with context number why not give > the kthread pids through attrs (or new interface) and the admin can > move those kthreads to the cgroup they want to charge against? Again, I just wanted to make this as simple as possible, and I also referenced blkback thread naming. And I find no special functional difference here, either. And yes, I think you suggested way is much more flexible and easy to be used. I will make this in that way. --- Just a note (not for only Shakeel, but anyone who interested in DAMON). The DAMON debugfs interface is not highly coupled with DAMON. Rather than that, it is implemented as an application using DAMON as a framework via the DAMON's kernel space interface. This means that anyone who want different user space interface can implement their own on top of the framework. I will try to make the changes as soon as possible, but if you cannot wait until then, you could implement your own. Similarly, DAMON lacks many functionality such as support of special address spaces. I already have a TODO list. And I will implement those one by one. So, please give me the requests. However, I believe the kernel space interface is already almost complete. Thus, almost every such future features could be implemented on top of current DAMON interface. Therefore, if you cannot wait until I finish the work, you can implement your own on DAMON's kernel space interface. Of course, if you send the patches for your own implementations, that will make not only I, but the community happier. And this is the reason why the patchset containing only the framework part and minimal applications / addons is titled as official 'PATCH', while the patchsets for the future features are titled 'RFC'. So, I am asking you to consider giving more attention to the framework part (the first 4 patches of the patchset[1]), as all future features will depend on it. [1] https://lore.kernel.org/linux-mm/20200817105137.19296-1-sjpark@amazon.com/ Thanks, SeongJae Park