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=-18.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT autolearn=ham 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 9A6DCC433DB for ; Tue, 19 Jan 2021 18:41:51 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 0844723109 for ; Tue, 19 Jan 2021 18:41:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0844723109 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 5B9676B0006; Tue, 19 Jan 2021 13:41:50 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 56A4B6B0012; Tue, 19 Jan 2021 13:41:50 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4587A6B0024; Tue, 19 Jan 2021 13:41:50 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0250.hostedemail.com [216.40.44.250]) by kanga.kvack.org (Postfix) with ESMTP id 2ED0B6B0006 for ; Tue, 19 Jan 2021 13:41:50 -0500 (EST) Received: from smtpin19.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id DA52E1EE6 for ; Tue, 19 Jan 2021 18:41:49 +0000 (UTC) X-FDA: 77723393538.19.toe91_240247627554 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin19.hostedemail.com (Postfix) with ESMTP id 80E531ACC2B for ; Tue, 19 Jan 2021 18:41:49 +0000 (UTC) X-HE-Tag: toe91_240247627554 X-Filterd-Recvd-Size: 5308 Received: from smtp-fw-9101.amazon.com (smtp-fw-9101.amazon.com [207.171.184.25]) by imf22.hostedemail.com (Postfix) with ESMTP for ; Tue, 19 Jan 2021 18:41:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1611081709; x=1642617709; h=from:to:cc:subject:date:message-id:in-reply-to: mime-version; bh=ZbYUR5dcTR5Pg5QurOsZdrIiwJ14CgBmEcmfusCljVc=; b=dxDKq3dZWQUalZQDQG0WFPRd82aYgBEN0F3/gKSv32A+mAdtgpX3k/tH 2BteDNcqwxs1rovcBlAKhRGSOSjy9VNwAnYD+15EMbw0V5zxNmUkkahn1 ZevhiCCJGqhrYT0C3Tr2gFFlU3P4kbiCbprf+4vH6l1DmgWhPiQnDyWEj w=; X-IronPort-AV: E=Sophos;i="5.79,359,1602547200"; d="scan'208";a="104947850" Received: from sea32-co-svc-lb4-vlan3.sea.corp.amazon.com (HELO email-inbound-relay-2b-a7fdc47a.us-west-2.amazon.com) ([10.47.23.38]) by smtp-border-fw-out-9101.sea19.amazon.com with ESMTP; 19 Jan 2021 18:41:40 +0000 Received: from EX13D31EUA004.ant.amazon.com (pdx1-ws-svc-p6-lb9-vlan2.pdx.amazon.com [10.236.137.194]) by email-inbound-relay-2b-a7fdc47a.us-west-2.amazon.com (Postfix) with ESMTPS id ECC5CC0616; Tue, 19 Jan 2021 18:41:37 +0000 (UTC) Received: from u3f2cd687b01c55.ant.amazon.com (10.43.162.125) by EX13D31EUA004.ant.amazon.com (10.43.165.161) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 19 Jan 2021 18:41:21 +0000 From: SeongJae Park To: SeongJae Park CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: Re: [RFC v10 01/13] damon/dbgfs: Allow users to set initial monitoring target regions Date: Tue, 19 Jan 2021 19:41:07 +0100 Message-ID: <20210119184107.1865-1-sjpark@amazon.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201216094221.11898-2-sjpark@amazon.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.43.162.125] X-ClientProxiedBy: EX13D22UWC003.ant.amazon.com (10.43.162.250) To EX13D31EUA004.ant.amazon.com (10.43.165.161) 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 Dec 2020 10:42:09 +0100 SeongJae Park wrote: > From: SeongJae Park > > Some 'damon-dbgfs' users would want to monitor only a part of the entire > virtual memory address space. The framework users in the kernel space > could use '->init_target_regions' callback or even set the regions > inside the context struct as they want, but 'damon-dbgfs' users cannot. > > For the reason, this commit introduces a new debugfs file, > 'init_region'. 'damon-dbgfs' users can specify which initial monitoring > target address regions they want by writing special input to the file. > The input should describe each region in each line in below form: > > > > Note that the regions will be updated to cover entire memory mapped > regions after 'regions update interval'. If you want the regions to not > be updated after the initial setting, you could set the interval as a > very long time, say, a few decades. > > Signed-off-by: SeongJae Park > --- > mm/damon/dbgfs.c | 154 ++++++++++++++++++++++++++++++++++++++++++++++- > 1 file changed, 151 insertions(+), 3 deletions(-) > > diff --git a/mm/damon/dbgfs.c b/mm/damon/dbgfs.c > index 06295c986dc3..2f1ec6ebd9f0 100644 > --- a/mm/damon/dbgfs.c > +++ b/mm/damon/dbgfs.c [...] > + > +static ssize_t dbgfs_init_regions_read(struct file *file, char __user *buf, > + size_t count, loff_t *ppos) > +{ > + struct damon_ctx *ctx = file->private_data; > + char *kbuf; > + ssize_t len; > + > + kbuf = kmalloc(count, GFP_KERNEL); > + if (!kbuf) > + return -ENOMEM; > + > + mutex_lock(&ctx->kdamond_lock); > + if (ctx->kdamond) { > + mutex_unlock(&ctx->kdamond_lock); > + return -EBUSY; Coverity Static Analysis Security Testing (SAST) by Synopsys, Inc. found that above return is missing deallocation of 'kbuf'. I will fix this in the next version. > + } > + > + len = sprint_init_regions(ctx, kbuf, count); > + mutex_unlock(&ctx->kdamond_lock); > + if (len < 0) > + goto out; > + len = simple_read_from_buffer(buf, count, ppos, kbuf, len); > + > +out: > + kfree(kbuf); > + return len; > +} Thanks, SeongJae Park [...]