Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp4225257pxf; Tue, 30 Mar 2021 02:27:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxUJMwIMJ7LBv+Y8A6XMxR0WA4AekK3th2MNPxxjVdXyNVgjdWBjpRZtjS3ZmsBw0d5ARVA X-Received: by 2002:a17:907:628a:: with SMTP id nd10mr32593776ejc.326.1617096420040; Tue, 30 Mar 2021 02:27:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617096420; cv=none; d=google.com; s=arc-20160816; b=h5hmzLdYigcsu12T6MXPORwueFwKDwMPoh5XVgu4pngdusmPmXFe739QFCkRgpGSHK QAVgMZKHqPizGulyvPsEjjJnEgLSKqFcyLp4ozHA9t3/QhEMnHprBK62dU+l+RKUhedN X9oHRVH9Zl3KZ2JnJqCYU12YQOphYrdc8UrHT9iyexWNWn0jQSpuzxTjw3s9nB28UHr7 fTX5BrfAZp66QTYQsBIGXl/NcR1QSwW6ix7nmeQRjjMDzXIm2RPF3vQdrZ/QIqpDQcQv RgNTupdpQCXjYM/Uf3pQUOxD/cFEgIAcazlxkNQlf1jenPJCC5X1DZCJ5OjadqtloP+g A1hQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature :dkim-signature; bh=MlIaANbX0g7R5hO66tttd3MFu5eTiezl/dlSwQ789Fk=; b=B+2CL1FduN0XzRxG/MkLI4OiMMrFNPppHDsJRSswBLBosSpEU8slnu4dz3AWS+NsVB guXw6/DGIc5WAtYWPEC58OPim0PgMfu+ev6+jOePZqW5f8gyNG7mo5P8foFM7fN5eTO7 kxRSfp2ysjbTIP/xHqTjh1t87I4/JPXx2+JJ489XJXXLcD21XPGEKSqADeq1GQSP42ti J4sYAMj8LGimRnhPQug+q9jd7E3okQCl1vhqj4vdqAO8xvlcLhLtU1NSTGce8a0KDzha LvwSQS170mfLZRfd6UACoODA+C9HedaQEgSP8jHrVEk92J0MUkaneftllgFTj5uU0CA5 5Kqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kroah.com header.s=fm3 header.b=obbYYJtI; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=uZlADrNc; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s9si14677577edc.296.2021.03.30.02.26.37; Tue, 30 Mar 2021 02:27:00 -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=@kroah.com header.s=fm3 header.b=obbYYJtI; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=uZlADrNc; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231600AbhC3JXW (ORCPT + 99 others); Tue, 30 Mar 2021 05:23:22 -0400 Received: from wnew3-smtp.messagingengine.com ([64.147.123.17]:41579 "EHLO wnew3-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231721AbhC3JWy (ORCPT ); Tue, 30 Mar 2021 05:22:54 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailnew.west.internal (Postfix) with ESMTP id ABECA17F2; Tue, 30 Mar 2021 05:22:51 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Tue, 30 Mar 2021 05:22:54 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kroah.com; h= date:from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm3; bh=MlIaANbX0g7R5hO66tttd3MFu5e Tiezl/dlSwQ789Fk=; b=obbYYJtIAYkCZ9uivDSjtFcFBTb+4n3pu6VOCyx0oLA vpZEwQAMNVUjVTHvuO46xKN54Tew3YKeRG1FGY2Ahtr7gdK69hRKgEsPsou/NAg4 NIFgf9GunbfIaw60K5MBGzK1DFln4TC2Aw1XgrAM3maXvhwcBt3c8aLV4gqkOZFo 0m7GJOpIY133kLk+PIrgrw+l96rllLxRgGXFDh9NYMAV3W5wGUmfzKS2tPOMD6uC JBlzt175GNtYSk1M9KZ/1OdJon6ovxKMcVqYxhODY2Ge/hLz8hZmEHfY0EwuvP0H GoMzP/5uw0T4K6AwzKMaRwIDVlTrnftVaGnFjkC9Hig== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=MlIaAN bX0g7R5hO66tttd3MFu5eTiezl/dlSwQ789Fk=; b=uZlADrNcGBjpzSMhBwpI1V 0BNMdOP3oYfAQOeJPwbRnuso5jGxMGJBV9k7lGMZ1ccGLK4RIM/ixwozWRS+600n jdKR3El7L1eegFVk78lnNOAriZ8dLaZ5FqKNRk0vbdMcfWHmv71jODHF3hNdJMdh 4Vg5mhgdJjbTGJrR5Hatu8gnCp2D2VEaBYLkgVx8jH2NQKaXMkkGuI2RQ2FH2Ghv cHWOkbeB3+3zVEYd6U5TjQ0CadFnOpZYtAqv8lTmY+gfWLyXjcToZnhdXtpi2/ZU gTg2h42C2Sh5w6AYBMX64OB/3faAj1hS8Dsg/Rl0z5ReM3CRPaBqqTNlmlf8mSMw == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrudeitddgudegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvffukfhfgggtuggjsehttdertddttddvnecuhfhrohhmpefirhgvghcu mffjuceoghhrvghgsehkrhhorghhrdgtohhmqeenucggtffrrghtthgvrhhnpeevueehje fgfffgiedvudekvdektdelleelgefhleejieeugeegveeuuddukedvteenucfkphepkeef rdekiedrjeegrdeigeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrih hlfhhrohhmpehgrhgvgheskhhrohgrhhdrtghomh X-ME-Proxy: Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) by mail.messagingengine.com (Postfix) with ESMTPA id 3593A24005D; Tue, 30 Mar 2021 05:22:47 -0400 (EDT) Date: Tue, 30 Mar 2021 11:22:45 +0200 From: Greg KH To: sj38.park@gmail.com Cc: akpm@linux-foundation.org, 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, gthelen@google.com, guoju.fgj@alibaba-inc.com, mgorman@suse.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, snu@amazon.de, 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 v26 07/13] mm/damon: Implement a debugfs-based user space interface Message-ID: References: <20210330090537.12143-1-sj38.park@gmail.com> <20210330090537.12143-8-sj38.park@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210330090537.12143-8-sj38.park@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 30, 2021 at 09:05:31AM +0000, sj38.park@gmail.com wrote: > +static int __init __damon_dbgfs_init(void) > +{ > + struct dentry *dbgfs_root; > + const char * const file_names[] = {"monitor_on"}; > + const struct file_operations *fops[] = {&monitor_on_fops}; > + int i; > + > + dbgfs_root = debugfs_create_dir("damon", NULL); > + > + for (i = 0; i < ARRAY_SIZE(file_names); i++) > + debugfs_create_file(file_names[i], 0600, dbgfs_root, NULL, > + fops[i]); > + dbgfs_fill_ctx_dir(dbgfs_root, dbgfs_ctxs[0]); > + > + dbgfs_dirs = kmalloc_array(1, sizeof(dbgfs_root), GFP_KERNEL); No error checking for memory allocation failures? > + dbgfs_dirs[0] = dbgfs_root; > + > + return 0; > +} > + > +/* > + * Functions for the initialization > + */ > + > +static int __init damon_dbgfs_init(void) > +{ > + int rc; > + > + dbgfs_ctxs = kmalloc(sizeof(*dbgfs_ctxs), GFP_KERNEL); No error checking? > + dbgfs_ctxs[0] = dbgfs_new_ctx(); > + if (!dbgfs_ctxs[0]) > + return -ENOMEM; > + dbgfs_nr_ctxs = 1; > + > + rc = __damon_dbgfs_init(); > + if (rc) > + pr_err("%s: dbgfs init failed\n", __func__); Shouldn't the error be printed out in the function that failed, not in this one? thanks, greg k-h