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=-10.9 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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 33430C4320E for ; Fri, 6 Aug 2021 00:43:11 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id B3BEB61181 for ; Fri, 6 Aug 2021 00:43:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org B3BEB61181 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id CD4298D0001; Thu, 5 Aug 2021 20:43:09 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C84EF6B0071; Thu, 5 Aug 2021 20:43:09 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B72C68D0001; Thu, 5 Aug 2021 20:43:09 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0080.hostedemail.com [216.40.44.80]) by kanga.kvack.org (Postfix) with ESMTP id 9BC726B006C for ; Thu, 5 Aug 2021 20:43:09 -0400 (EDT) Received: from smtpin27.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 4D770181AF5D8 for ; Fri, 6 Aug 2021 00:43:09 +0000 (UTC) X-FDA: 78442806498.27.D896153 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf14.hostedemail.com (Postfix) with ESMTP id F2C1760022FA for ; Fri, 6 Aug 2021 00:43:08 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id 3F13761184; Fri, 6 Aug 2021 00:43:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1628210588; bh=iSyRQEsIeNF4sicG4iDdhNRNXfrtXmJBuL9zRRvHZbo=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=CI/WU5o0NXX+lpLnneSa22rzMVR5Ow+ec2rhqWWg7D6zqdz2W0uHbrQADp9o06Qge D8JL9bqe1pTiEEDHdp/hYqaxLYok71uVO2CaFYGmNY486Xj9zOT0UnMj7ZCOo1L+Yl vV6gkNz/0uoGaOXpYZUAjyxBx2uJLRrfYHesU+aw= Date: Thu, 5 Aug 2021 17:43:04 -0700 From: Andrew Morton To: SeongJae Park Cc: SeongJae Park , Jonathan.Cameron@Huawei.com, acme@kernel.org, alexander.shishkin@linux.intel.com, amit@kernel.org, benh@kernel.crashing.org, brendanhiggins@google.com, corbet@lwn.net, david@redhat.com, dwmw@amazon.com, elver@google.com, fan.du@intel.com, foersleo@amazon.de, greg@kroah.com, gthelen@google.com, guoju.fgj@alibaba-inc.com, jgowans@amazon.com, joe@perches.com, mgorman@suse.de, mheyne@amazon.de, minchan@kernel.org, mingo@redhat.com, namhyung@kernel.org, peterz@infradead.org, riel@surriel.com, rientjes@google.com, rostedt@goodmis.org, rppt@kernel.org, shakeelb@google.com, shuah@kernel.org, sieberf@amazon.com, snu@zelle79.org, vbabka@suse.cz, vdavydov.dev@gmail.com, zgf574564920@gmail.com, linux-damon@amazon.com, linux-mm@kvack.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v34 07/13] mm/damon: Implement a debugfs-based user space interface Message-Id: <20210805174304.3c3d8c8ee971bc9ddf6988af@linux-foundation.org> In-Reply-To: <20210716081449.22187-8-sj38.park@gmail.com> References: <20210716081449.22187-1-sj38.park@gmail.com> <20210716081449.22187-8-sj38.park@gmail.com> X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.32; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b="CI/WU5o0"; spf=pass (imf14.hostedemail.com: domain of akpm@linux-foundation.org designates 198.145.29.99 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org; dmarc=none X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: F2C1760022FA X-Stat-Signature: anudd9aoqqssnz6p5pr8xhe9ka9jsbfq X-HE-Tag: 1628210588-289613 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 Fri, 16 Jul 2021 08:14:43 +0000 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. > 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 int __init damon_dbgfs_init(void) > +{ > + int rc; > + > + dbgfs_ctxs = kmalloc(sizeof(*dbgfs_ctxs), GFP_KERNEL); > + if (!dbgfs_ctxs) { > + pr_err("%s: dbgfs ctxs alloc failed\n", __func__); > + return -ENOMEM; > + } > + dbgfs_ctxs[0] = dbgfs_new_ctx(); > + if (!dbgfs_ctxs[0]) { > + kfree(dbgfs_ctxs); > + pr_err("%s: dbgfs ctx alloc failed\n", __func__); > + return -ENOMEM; > + } checkpatch points out that the "alloc failed" messages are unneeded - kmalloc(GFP_KERNEL) will have already emitted a stack trace. Is this fixup OK? --- a/mm/damon/dbgfs.c~mm-damon-implement-a-debugfs-based-user-space-interface-fix +++ a/mm/damon/dbgfs.c @@ -373,14 +373,11 @@ static int __init damon_dbgfs_init(void) int rc; dbgfs_ctxs = kmalloc(sizeof(*dbgfs_ctxs), GFP_KERNEL); - if (!dbgfs_ctxs) { - pr_err("%s: dbgfs ctxs alloc failed\n", __func__); + if (!dbgfs_ctxs) return -ENOMEM; - } dbgfs_ctxs[0] = dbgfs_new_ctx(); if (!dbgfs_ctxs[0]) { kfree(dbgfs_ctxs); - pr_err("%s: dbgfs ctx alloc failed\n", __func__); return -ENOMEM; } dbgfs_nr_ctxs = 1; _