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=-5.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=no 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 3084CC433C1 for ; Tue, 30 Mar 2021 10:20:16 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id AF714619A9 for ; Tue, 30 Mar 2021 10:20:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AF714619A9 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 2EFDA6B0080; Tue, 30 Mar 2021 06:20:15 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2A0566B0081; Tue, 30 Mar 2021 06:20:15 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0F32E6B0082; Tue, 30 Mar 2021 06:20:15 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0029.hostedemail.com [216.40.44.29]) by kanga.kvack.org (Postfix) with ESMTP id EACAF6B0080 for ; Tue, 30 Mar 2021 06:20:14 -0400 (EDT) Received: from smtpin29.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id A463D181AEF3E for ; Tue, 30 Mar 2021 10:20:14 +0000 (UTC) X-FDA: 77976145548.29.9191C8B Received: from mail-qk1-f179.google.com (mail-qk1-f179.google.com [209.85.222.179]) by imf10.hostedemail.com (Postfix) with ESMTP id 125D640002C6 for ; Tue, 30 Mar 2021 10:20:10 +0000 (UTC) Received: by mail-qk1-f179.google.com with SMTP id o5so15324660qkb.0 for ; Tue, 30 Mar 2021 03:20:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to; bh=k7hxZENd7NdPTgDY/2orpsQOL2ON+8/T0SHT2+4p2oU=; b=qOyo8WUtNbyCQLTbQYFC4L6CFPxxsa2MI/ijfZ3jK+PazAZEPMINiCJvTTMtSQB4kH 9GrMqYedes9YEB2hzsEUvOnq7go5SmVYhMb6zd/Zpco6JQXlA9HkKxwaIGW22Vf4i9h2 S8/oGqkjsP3gB1m25RZx/JvuxRolQGoo07wpjMnuvdTpXgMVxwrzJ8gzGSAeHONqYDYN i3ZTs1SzSzyPAYSX/jzve/m8p/fJOXXWJMUl1v51EOeUDFvgXzTPE1ZkpIi+GeDfoKul DPQmlZ5uBAvbLYZtr8a/AqRrictKqMlSjED0eOHRIB6zjpDfPFLh5t0i5CpYQovQemdu LmSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to; bh=k7hxZENd7NdPTgDY/2orpsQOL2ON+8/T0SHT2+4p2oU=; b=TRKttk6ZN2E+uKQ6BJVIuWK60P8GAcxZd5G2NhZ+8Xr628bo6jJunJzIwj3lVjFPQq dG+AIoJuRRwnNEWfP3q9gTAvcxuYF0ffn8zDbHTdZap/sty4nFwRHnr1U/u+ekPpTZzS 8AGWICXDhqJQSx6JA82CPq0UTsIeQGGO+pakwVwM+b7JMhTiXJnenYhDR4LYo3mAgve2 eDff6S7MKZtClP0czqhZW5xp8s6a3tU28qLBr3GKnS4+BIkLQxeO0Im2XXR4S4NRHLA7 OMu0Hx7tXtJX9dF22rVzU1rf9jUVR2y7qa98a4SpV/8gav+RWYBdQjuADTOuNIG6C6/Q zstQ== X-Gm-Message-State: AOAM533n2+gA77iS5a7AtIveabJbTKHDc+/JhcAZlH+rXhRAeEkpgbOO gpGCoxqUoKY3NQLAPxOTVrQ= X-Google-Smtp-Source: ABdhPJwJ6DQyZii4Hb/HRz8XLhQyf4qv6XeCIdgjJLTHxVNWGCWgHhoyFVBAEMWz7RUahJninMF7xA== X-Received: by 2002:a05:620a:16d3:: with SMTP id a19mr29082409qkn.88.1617099613534; Tue, 30 Mar 2021 03:20:13 -0700 (PDT) Received: from localhost.localdomain (ec2-35-169-212-159.compute-1.amazonaws.com. [35.169.212.159]) by smtp.gmail.com with ESMTPSA id 66sm15283942qkk.18.2021.03.30.03.20.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Mar 2021 03:20:12 -0700 (PDT) From: SeongJae Park X-Google-Original-From: SeongJae Park To: SeongJae Park Cc: Greg KH , 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 Date: Tue, 30 Mar 2021 10:20:06 +0000 Message-Id: <20210330102006.34049-1-sjpark@amazon.de> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210330095950.33427-1-sjpark@amazon.de> X-Rspamd-Queue-Id: 125D640002C6 X-Stat-Signature: fh1y9u8tkgauiqbsrqorrxpr69hu4niz X-Rspamd-Server: rspam02 Received-SPF: none (gmail.com>: No applicable sender policy available) receiver=imf10; identity=mailfrom; envelope-from=""; helo=mail-qk1-f179.google.com; client-ip=209.85.222.179 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1617099610-592080 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: From: SeongJae Park On Tue, 30 Mar 2021 09:59:50 +0000 SeongJae Park wrote: > From: SeongJae Park > > On Tue, 30 Mar 2021 11:22:45 +0200 Greg KH wrote: > > > 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? > > Oops, I will add the check in the next spin. > > > > > > > > + 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? > > Will add in the next spin. > > > > > > + dbgfs_ctxs[0] = dbgfs_new_ctx(); > > > + if (!dbgfs_ctxs[0]) > > > + return -ENOMEM; And, I found that I'm not printing the error for this failure. I guess this might made you to to think below error message should printed inside the callee. I will add 'pr_err()' here and above unchecked failure case, in the next version. BTW, I forgot saying thank you for your review. Appreciate! Thanks, SeongJae Park > > > + 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? > > I thought some other functions (in future) might want to use > '__damon_dbgfs_init()' but siletnly handles it's failure. Therefore I made the > function fails silently but returns the error code explicitly. Am I missing > somthing? > > > Thanks, > SeongJae Park > > > > > thanks, > > > > greg k-h >