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=-14.4 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=no 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 E313FC43461 for ; Wed, 16 Sep 2020 16:11:34 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 59AC92225F for ; Wed, 16 Sep 2020 16:11:34 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="hKDswPUk" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 59AC92225F Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id E5E906B0037; Wed, 16 Sep 2020 12:11:33 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E0D176B005A; Wed, 16 Sep 2020 12:11:33 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D0F018E0001; Wed, 16 Sep 2020 12:11:33 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0025.hostedemail.com [216.40.44.25]) by kanga.kvack.org (Postfix) with ESMTP id B8F766B0037 for ; Wed, 16 Sep 2020 12:11:33 -0400 (EDT) Received: from smtpin28.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 7EEEE2461 for ; Wed, 16 Sep 2020 16:11:33 +0000 (UTC) X-FDA: 77269414866.28.linen51_61177fd2711b Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin28.hostedemail.com (Postfix) with ESMTP id 4F9D36C04 for ; Wed, 16 Sep 2020 16:11:33 +0000 (UTC) X-HE-Tag: linen51_61177fd2711b X-Filterd-Recvd-Size: 5528 Received: from mail-lf1-f65.google.com (mail-lf1-f65.google.com [209.85.167.65]) by imf10.hostedemail.com (Postfix) with ESMTP for ; Wed, 16 Sep 2020 16:11:32 +0000 (UTC) Received: by mail-lf1-f65.google.com with SMTP id m5so7593955lfp.7 for ; Wed, 16 Sep 2020 09:11:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=xM847DRY5VbfgME6R21m1SfXUf/uGuxPDsbHMsNay3U=; b=hKDswPUkgyP7KsRAEQnw4b2+wQq1wAyUkDPrRrg88wJzF488+tYfUAH71qQJ5RFRPC UTOQhJGBS7tiYZ+F+7abR9j1+eHbkxqL/DmLTrWZIE3eFy9FBQViIDNj9QU4UJoSSA5a +XdUrXBw5BIAjEXxN0I0wAESVftczz8J3O/vhOnihktkYuhEpcpTRoSRcHRkaNuhJOzj qBZ2qUG3jBZQDWpddafVMR5Yo+cemVff7MvTyzCggUtB8YUOKjbiDouRwwWDjyqGTNJc v7MbSkNWBHqH+++JkmFK4qhhPIXzfnqfZ/gU1UOV8zQuyDSu/ngrJ4jWFmZbWdE99oQz 8Lfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=xM847DRY5VbfgME6R21m1SfXUf/uGuxPDsbHMsNay3U=; b=i33zf+lOjm2Ne6ixKIF+jUGv5ARu9OWi77nbVeVmlEbS/zf2ktXXGW4O0tejklH3fH cMUFG7wreRs9SVgH7QURpdd84LpMIIWfyT55wmyJbg8wChsUc0l7J/SZshwXkReDVAFr oyZ//dsS0ZGNnR9tlhlnbfIOmrMslUCtSwxgbrtQks88u/tunjTtK0js9rqHOFVHaPOZ bY1GuD266yrJP4UgEFzDrGRTDcAXdPIZg1X2qmDLECGW2q7iMEXWHmoUhzZtVlrWpAW6 J6OHOGQf4fjdnm6Gf/dT3s57ijabJAsIsDnDgxvDMxOBhoy8TUYmcyVOlvOdu6AMaq1Z 8mwQ== X-Gm-Message-State: AOAM531lslxX6JlWcPUlDCdmfJ0EH2BXEcqKB3sZyu6BbQ6yNMfwnZn3 qqwSC4j7WasXyn1r3lTLXdrjYsFwl2PCsojnzjgA+Q== X-Google-Smtp-Source: ABdhPJxlV8OQGTI/jgSgIoAV3Cuw+6CQr9/1xF6SkEn4+P2CCa9DerMGUn4j4076dFJ7Mxe3d1DPzPr+326L2DCNr34= X-Received: by 2002:ac2:59da:: with SMTP id x26mr8500214lfn.346.1600272690424; Wed, 16 Sep 2020 09:11:30 -0700 (PDT) MIME-Version: 1.0 References: <20200915180225.17439-1-sjpark@amazon.com> <20200915180225.17439-3-sjpark@amazon.com> In-Reply-To: <20200915180225.17439-3-sjpark@amazon.com> From: Shakeel Butt Date: Wed, 16 Sep 2020 09:11:18 -0700 Message-ID: Subject: Re: [RFC PATCH 2/2] mm/damon/debugfs: Support multiple contexts To: SeongJae Park Cc: Andrew Morton , SeongJae Park , Jonathan.Cameron@huawei.com, Andrea Arcangeli , acme@kernel.org, alexander.shishkin@linux.intel.com, amit@kernel.org, benh@kernel.crashing.org, brendan.d.gregg@gmail.com, Brendan Higgins , Qian Cai , Colin Ian King , Jonathan Corbet , David Hildenbrand , dwmw@amazon.com, Marco Elver , "Du, Fan" , foersleo@amazon.de, Greg Thelen , Ian Rogers , jolsa@redhat.com, "Kirill A. Shutemov" , mark.rutland@arm.com, Mel Gorman , Minchan Kim , Ingo Molnar , namhyung@kernel.org, "Peter Zijlstra (Intel)" , Randy Dunlap , Rik van Riel , David Rientjes , Steven Rostedt , rppt@kernel.org, sblbir@amazon.com, shuah@kernel.org, sj38.park@gmail.com, snu@amazon.de, Vlastimil Babka , Vladimir Davydov , Yang Shi , Huang Ying , zgf574564920@gmail.com, linux-damon@amazon.com, Linux MM , linux-doc@vger.kernel.org, LKML Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4F9D36C04 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam03 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 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? > 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? > The first context related files are still in > the DAMON debugfs root directory, though. > > Signed-off-by: SeongJae Park > ---