Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp530526pxk; Wed, 16 Sep 2020 10:01:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwi3n2n43grjrcf+MiavEs6gnudeVMReBOyybk7hhLwzg8QMC+7DnZCUBjJx7THYyTQ1Xcw X-Received: by 2002:a17:906:a156:: with SMTP id bu22mr27748651ejb.177.1600275703691; Wed, 16 Sep 2020 10:01:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600275703; cv=none; d=google.com; s=arc-20160816; b=aehQXPZuuOIpkdZ6FhE+xisVux4ufzwTtDu39PjPaUpOkaPwxr1ncVHpRoKgnJg8g2 SWtZNFL0isGtJhAy52XZF/yKh8sISozKxC+B+A4oprr1Iktwd4D0iaWWBZGAPYF0fAaL x8N0D/Htegt3rrTPMPCFc+c2S1efjkTVRr+QzKKsrNnu2pSB7+bNYf5Tvi/MtHYojUdk nKbtidCAiZJD/YlE9ExAIFlH/MmgPzdGCszXaclsv9jGdVyWfT1W3dWfu92JGgjZAmkt Mr5iv/ZgDtEOT9xf6ZZNYdJhdACDCYMpkv+T2j9mVTkMurimtJiq4+XhYSM/nzVMa2Xw ftlw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=xM847DRY5VbfgME6R21m1SfXUf/uGuxPDsbHMsNay3U=; b=ACd6r+5ZTPMcTNRNewkhp3B7/OD7zH5itfthD+vjv/5eSv/7YlRQ4MpB1gsIKCVvmw pLTP2d94eIbgmaI9797rs3g5NZcBZezJP0Ft6l3ZO9jWLX2IotHKmS6VDspNUssC0hdn 9xBS0LpgtvmZ80y0loCQNMKB7PNj6s3Q7pjlPLxIAiwPpcCggVohYtqD3DfnBOGmDYnz 9jwrNqtlPhT2omP2FK+EpLwPfVjRlpIuXLTCbmAjwFK0T2p5fz9JaPDo5k4WNlfZrw9n 4QDezT+9K0dBb807ORizJWsmpJMuW8MTOK4snoQF9d6u3kTGFNwJ7AqZoJMBMpuEIxcr 4rpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=hKDswPUk; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g15si12791053ejd.257.2020.09.16.10.01.20; Wed, 16 Sep 2020 10:01:43 -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=@google.com header.s=20161025 header.b=hKDswPUk; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726654AbgIPQ4R (ORCPT + 99 others); Wed, 16 Sep 2020 12:56:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51884 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726586AbgIPQd2 (ORCPT ); Wed, 16 Sep 2020 12:33:28 -0400 Received: from mail-lf1-x143.google.com (mail-lf1-x143.google.com [IPv6:2a00:1450:4864:20::143]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0F642C02C2A2 for ; Wed, 16 Sep 2020 09:11:33 -0700 (PDT) Received: by mail-lf1-x143.google.com with SMTP id z17so7560651lfi.12 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=Aj8pUz0x3Y0Nhf8/xrXDx84u4neKazwpmZSKdpMR+LzLpFBKWxjRWCAZSJ8XUrDMdB EUr6K7/33sXWgqcOs26l83oQbW5TSlrVT+0IezSieakmiADPzQLK9ATkBj9+nEJyEeHC ds5rBM1xO0xNEEKt6FbknGx69DNPwXNfVr6VJw+/Z88NR3u4SNukDcAbFOwyH7r55bbL MrlwewlVR2KIsh/jHj1MKIy/83x9BWd61PkMXMdov+NUhCy+t9j+nZ4pH3wpdtOj8zDi MeQ4tpDS2afzCb/M2F8USUIQ50sMNDupEBYXq7hFgEZ1FKDFhlUoDOl6oUCnYz3nXQ3G LmDQ== X-Gm-Message-State: AOAM533Pl/Q1o03ibv99xjJBr2MZiGTqiboBvSF1JkOanFLPVLecb5vn cYdbdU+G9HZFFfEeQERVydK61PF8NF5Qd1qYimhlYg== 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" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > ---