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.8 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, 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 B7D66C48BE6 for ; Mon, 14 Jun 2021 06:48:09 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 3BFC661370 for ; Mon, 14 Jun 2021 06:48:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3BFC661370 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 B6E166B006C; Mon, 14 Jun 2021 02:48:08 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B1DDD6B006E; Mon, 14 Jun 2021 02:48:08 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9974F6B0070; Mon, 14 Jun 2021 02:48:08 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0088.hostedemail.com [216.40.44.88]) by kanga.kvack.org (Postfix) with ESMTP id 671156B006C for ; Mon, 14 Jun 2021 02:48:08 -0400 (EDT) Received: from smtpin36.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id E5D8A180AD806 for ; Mon, 14 Jun 2021 06:48:07 +0000 (UTC) X-FDA: 78251399814.36.E8F7A1A Received: from mail-qk1-f172.google.com (mail-qk1-f172.google.com [209.85.222.172]) by imf21.hostedemail.com (Postfix) with ESMTP id A5E00E000263 for ; Mon, 14 Jun 2021 06:47:56 +0000 (UTC) Received: by mail-qk1-f172.google.com with SMTP id c124so37430481qkd.8 for ; Sun, 13 Jun 2021 23:48:07 -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=VXB3sDXLr2J/PWK7WC7SwWZiu5cXaiPOgPfes8Vb4PQ=; b=YqooeYuGVGMWri5CwsoSuuJ76S7ucjYYkrw1F+lKGb2apzv7HWD1YGN+KRK1TQqU/5 85LGFATx5csHIBSyxrZc9qASUL4slKeAA87q4O3ORBGgBwS2KzJSUL42KWqpfQpbv36v 9cK2PJJ/ZBAF32D0hsoCvT6CWkOlHYnQUDZ1qsFezOCR58YFUAeoKoQWKEbWfVm2vGiL WpVNn4nv2iTQGK9PFzvMRLm6sVEFOGRXOS34FgBdt2+InfHUshMQOc2pWcP1CDMyvBpT sMw1cSYM0JsWf5KO9UpuXLkBUVo0A3C0RheFQWqQ424dmDME6VybSQkVlA8cEB2n83PW 5ojQ== 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=VXB3sDXLr2J/PWK7WC7SwWZiu5cXaiPOgPfes8Vb4PQ=; b=oB/t33BhLsAPgzG853EQ6J8LY74tkQ4A/JlDxuJ/OKUJnqlOlNkJpnYOck7sojYjjc DcY+93L+kSy8qJa8WuS2TY3WjfmyT48wOSdOnabMM5S6HG1eArn8WO1DS2eeMf9WdUOw tKJPQK52g79419iMcYBDC0Fb6vtTAqtNmbhs/HMYircIz/Q1UAcpbWU4DLw9ds9wIn2h 0OtEBwneT5fnqRnukOYCCMwpSXMW21ESlp0m/6LEygjYnh6p6NIuYHBzkRncYnvVTBOO ySVDFGheuRO9WB/BLApIg3A7Q1fPeLhSJm6DiZgSy3M+SicB+8h4LVtVClhZus7By3jB CTNA== X-Gm-Message-State: AOAM530ZOcqn4taUYlC1W3JurH6Bivh0ZkJxQbwXmfz0/Z8ZSeK+kH5u D12j4p9D4dIx1plVEsVpK9M= X-Google-Smtp-Source: ABdhPJxkXE+S9KhgTAdMqh79idvZVqNV9wmabFXT7bYaNYhhiBrZAwd/l8BcWyDTEzBSv2hco3jOcQ== X-Received: by 2002:a37:6409:: with SMTP id y9mr7716148qkb.18.1623653286874; Sun, 13 Jun 2021 23:48:06 -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 h68sm9625254qkf.126.2021.06.13.23.48.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 13 Jun 2021 23:48:06 -0700 (PDT) From: SeongJae Park X-Google-Original-From: SeongJae Park To: sieberf@amazon.com Cc: sj38.park@gmail.com, Jonathan.Cameron@Huawei.com, acme@kernel.org, akpm@linux-foundation.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, linux-damon@amazon.com, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, 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, sjpark@amazon.de, snu@amazon.de, vbabka@suse.cz, vdavydov.dev@gmail.com, zgf574564920@gmail.com Subject: Re: [PATCH v29 07/13] mm/damon: Implement a debugfs-based user space interface Date: Mon, 14 Jun 2021 06:48:00 +0000 Message-Id: <20210614064800.14606-1-sjpark@amazon.de> X-Mailer: git-send-email 2.17.1 In-Reply-To: X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: A5E00E000263 Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=YqooeYuG; spf=pass (imf21.hostedemail.com: domain of sj38park@gmail.com designates 209.85.222.172 as permitted sender) smtp.mailfrom=sj38park@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-Stat-Signature: gt6bm596pwbj6xzhb3n97arod7oxhqfo X-HE-Tag: 1623653276-560625 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: Thank you for the comments! On Fri, 11 Jun 2021 20:59:04 +0200 wrote: > + Returns non-empty string on success, negarive error code otherwise. > > Nit: typo, 'negarive' Good catch! I will fix this in the next spin. > > > + if (ctx->kdamond) { > + if (targetid_is_pid(ctx)) > + dbgfs_put_pids(targets, nr_targets); > + ret = -EBUSY; > + goto unlock_out; > > I don't understand this block, what does EBUSY mean in this context? That means DAMON is busy because someone already requested running the monitoring context. So, the user will be able to wait a little bit and try later, or try to figure out who requested the monitoring. > > + if (sscanf(kbuf, "%s", kbuf) != 1) { > + kfree(kbuf); > + return -EINVAL; > + } > > Nit, this diverts from other patterns use elsewhere where error > conditions that need to free memory use a goto label. I want to use 'goto' only if it makes the code shorter and easier to read. In this case, this is the only one case that could use the 'goto' statement. And, this part would still be two lines like below: if (sscanf(kbuf, "%s", kbuf) != 1) { ret = -EINVAL; goto out; } Meanwhile, to use the 'goto', we would need to add the label below, so we will only add one more line. Therefore, I think using 'goto' here doesn't really reduce the lines of code or make it easier to read. So, if you don't care, I'd like to use current code as is. If I missed something, please let me know. Thanks, SeongJae Park