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.1 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=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 652C9C433E0 for ; Tue, 2 Feb 2021 10:30:01 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id EB88364F58 for ; Tue, 2 Feb 2021 10:30:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EB88364F58 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 6568C6B0072; Tue, 2 Feb 2021 05:30:00 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 606C16B0074; Tue, 2 Feb 2021 05:30:00 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4F5376B0075; Tue, 2 Feb 2021 05:30:00 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0231.hostedemail.com [216.40.44.231]) by kanga.kvack.org (Postfix) with ESMTP id 3A2706B0072 for ; Tue, 2 Feb 2021 05:30:00 -0500 (EST) Received: from smtpin06.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id ED6773620 for ; Tue, 2 Feb 2021 10:29:59 +0000 (UTC) X-FDA: 77772957318.06.room09_5c150ec275ca Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin06.hostedemail.com (Postfix) with ESMTP id C8D78100372EA for ; Tue, 2 Feb 2021 10:29:59 +0000 (UTC) X-HE-Tag: room09_5c150ec275ca X-Filterd-Recvd-Size: 5980 Received: from smtp-fw-2101.amazon.com (smtp-fw-2101.amazon.com [72.21.196.25]) by imf23.hostedemail.com (Postfix) with ESMTP for ; Tue, 2 Feb 2021 10:29:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1612261799; x=1643797799; h=from:to:cc:subject:date:message-id:mime-version; bh=2RDJc6PQy/jNoS1A1iab9BqoPd62gsRlaquyZUslpm4=; b=SLw7LNIOH+g7Oa9tcgt5FIsTz8rJ/ZWIxACXr6tYuFuH6M7UBNylNQ9K gENc1XlI4/GdNaWdnMNdUwsvC5NJwOa7PW+b2oZ8RbRcb+MpRfLCX5o88 /VoWvm9mPLCV1nE8RbA8bb+pIR3aUC3diUkEuc1nxilyr3UbaWUZhRrcS o=; X-IronPort-AV: E=Sophos;i="5.79,394,1602547200"; d="scan'208";a="79018249" Received: from iad12-co-svc-p1-lb1-vlan3.amazon.com (HELO email-inbound-relay-2b-c7131dcf.us-west-2.amazon.com) ([10.43.8.6]) by smtp-border-fw-out-2101.iad2.amazon.com with ESMTP; 02 Feb 2021 10:29:49 +0000 Received: from EX13D31EUA001.ant.amazon.com (pdx1-ws-svc-p6-lb9-vlan2.pdx.amazon.com [10.236.137.194]) by email-inbound-relay-2b-c7131dcf.us-west-2.amazon.com (Postfix) with ESMTPS id AE3E5A176A; Tue, 2 Feb 2021 10:29:46 +0000 (UTC) Received: from u3f2cd687b01c55.ant.amazon.com (10.43.162.208) by EX13D31EUA001.ant.amazon.com (10.43.165.15) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 2 Feb 2021 10:29:29 +0000 From: SeongJae Park To: CC: Shakeel Butt , , "Andrea Arcangeli" , , , , , , Brendan Higgins , Qian Cai , Colin Ian King , Jonathan Corbet , "David Hildenbrand" , , Marco Elver , "Du, Fan" , , "Greg Thelen" , Ian Rogers , , "Kirill A. Shutemov" , Mark Rutland , Mel Gorman , Minchan Kim , Ingo Molnar , , "Peter Zijlstra (Intel)" , Randy Dunlap , Rik van Riel , David Rientjes , Steven Rostedt , Mike Rapoport , , Shuah Khan , , , Vlastimil Babka , Vladimir Davydov , Yang Shi , Huang Ying , , , Linux MM , , LKML Subject: Re: [PATCH v23 07/15] mm/damon: Implement a debugfs-based user space interface Date: Tue, 2 Feb 2021 11:29:15 +0100 Message-ID: <20210202102915.19902-1-sjpark@amazon.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.43.162.208] X-ClientProxiedBy: EX13D27UWB004.ant.amazon.com (10.43.161.101) To EX13D31EUA001.ant.amazon.com (10.43.165.15) 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 Mon, 1 Feb 2021 09:37:39 -0800 Shakeel Butt wrote: > > > On Tue, Dec 15, 2020 at 3:59 AM SeongJae Park wrote: > > > > > > From: SeongJae Park > > > > > > DAMON is designed to be used by kernel space code such as the memory > > > management subsystems, and therefore it provides only kernel space API. > > > > Which kernel space APIs are being referred here? > > The symbols in 'include/linux/damon.h' > > > > > > That said, letting the user space control DAMON could provide some > > > benefits to them. For example, it will allow user space to analyze > > > their specific workloads and make their own special optimizations. > > > > > > For such cases, this commit implements a simple DAMON application kernel > > > module, namely 'damon-dbgfs', which merely wraps the DAMON api and > > > exports those to the user space via the debugfs. > > > > [...] > > > +static ssize_t dbgfs_target_ids_write(struct file *file, > > > + const char __user *buf, size_t count, loff_t *ppos) > > > +{ > > > + struct damon_ctx *ctx = file->private_data; > > > + char *kbuf, *nrs; > > > + unsigned long *targets; > > > + ssize_t nr_targets; > > > + ssize_t ret = count; > > > + int i; > > > + int err; > > > + > > > + kbuf = user_input_str(buf, count, ppos); > > > + if (IS_ERR(kbuf)) > > > + return PTR_ERR(kbuf); > > > + > > > + nrs = kbuf; > > > + > > > + targets = str_to_target_ids(nrs, ret, &nr_targets); > > > + if (!targets) { > > > + ret = -ENOMEM; > > > + goto out; > > > + } > > > + > > > + if (targetid_is_pid(ctx)) { > > > + for (i = 0; i < nr_targets; i++) > > > + targets[i] = (unsigned long)find_get_pid( > > > + (int)targets[i]); > > > + } > > > + > > > + mutex_lock(&ctx->kdamond_lock); > > > + if (ctx->kdamond) { > > > + ret = -EINVAL; > > > + goto unlock_out; > > > > You need to put_pid on the targets array. > > Good catch! > > > > > > + } > > > + > > > + err = damon_set_targets(ctx, targets, nr_targets); > > > + if (err) > > > + ret = err; > > > > You need to handle the partial failure from damon_set_targets(). > > My intention is to keep partial success as is. But, we should put_pid() partial failures... I will simply make this to completely fail with no registered target. Thanks, SeongJae Park [...]