Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp205550pxk; Thu, 17 Sep 2020 00:16:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJweg9ck7X9B2D1tyg5sfNUWMY/BTj1CXSI1oriUqedPcwB9yUHEzV6YsiaS/piiDJ+1omCQ X-Received: by 2002:a17:906:4956:: with SMTP id f22mr27853611ejt.62.1600326993683; Thu, 17 Sep 2020 00:16:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600326993; cv=none; d=google.com; s=arc-20160816; b=VFBysu7sDq6q8bnvLyoLayJz9JPlMsiMGolUAkvZzN0HrYTuyFgSl7fmfPRpOaH16C uswgs+JY3lcky3ZkxAe7uToCtqc6FpYhUQNtXcPKyoZ3dQOAksphhnl0sRF94BspiQKr GO0IUoE9h6LMgeKTtWO+Z0lj6wvtXssZ/BXRnGFlC7bmb7PQR2n7FGwa6Ch7UEOMSmaf S5B+/r1EhGLqgmPf4ZNuiC3nki8Kfx5qDAyiffKPp2I2W6svY+kJ5o073qp1SqmOEGll Dtzp08ew1Os5185g/BmO9/e5+Y031duIlFm8JcP1odCK3rUVyyq7Ue3Fgox6eIeScQZh JCAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:in-reply-to:message-id:date:subject :cc:to:from:dkim-signature; bh=bT02fndMmz9E4+y+xqKPl+BUNHOX1Ddkk2I4qA/LheA=; b=eQE5SXfoecXYzUL7Es6S7uuMWIQS2KV5Skbi/XpuTDmBRQp/RjQ/V3IMtflPmBTsgz zxETjEuFt0azHl5Zoiry/fCn7nzOrie+asCQcRzU6DuumWYotHutjSXb8iOR0P0EeP/Q VxM8GCVvXZpMQW/hfJAJ0L+Oo6erDSBakwxnqmcyibWuR1A3evv1jkO4nOZlOxxivej/ lsl7LLSB5H0yd0oLXOKVCLcUaIQMRiY4rHcsAByPqFdBiioAsC21PiVVZbCnQ09bPMNB ypPlfy04hISdW9pGNExFKtfODNAR/yQib9WvbqHBokyErUG3b89vcQbVLO0XAitzXkw5 iifQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amazon.com header.s=amazon201209 header.b=iOqYzDKK; 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 f24si13784117edr.375.2020.09.17.00.16.10; Thu, 17 Sep 2020 00:16:33 -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=iOqYzDKK; 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 S1726201AbgIQHNH (ORCPT + 99 others); Thu, 17 Sep 2020 03:13:07 -0400 Received: from smtp-fw-4101.amazon.com ([72.21.198.25]:17809 "EHLO smtp-fw-4101.amazon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726106AbgIQHNG (ORCPT ); Thu, 17 Sep 2020 03:13:06 -0400 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) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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