Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2511668pxj; Sun, 13 Jun 2021 23:50:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyMGkB/01V7h+5xJXjxnUpseRvy9p00fWWUfFlQqJ8iXwhr7UWPx/UaFg/d+PEKYvl5OcqU X-Received: by 2002:a05:6402:27c9:: with SMTP id c9mr15695640ede.371.1623653433533; Sun, 13 Jun 2021 23:50:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623653433; cv=none; d=google.com; s=arc-20160816; b=L/iY+ZVADpmq4L1c/vBirS3JnQ28Jdc5XUCXExMoP4CGEVHCdFsmHFHL2mWhhFCAjb a19KvdYvuuCW5hAKW9UPLE0ghyXs51TuDbkZ4ZOvuhIVMWmhbyGfzkrA7bHG0FjKQ7GC hWVW4A9qmO2LXvETVlRgtvqm21mHaprWZIMFeBBoZwiG44rxDRfEWyBvxSxVh/y21I8m aCzVWE25y7B9+eyucTTiFx8Y7bKtsi7bHjFI841ZanYkUEAoKV1pedc9C7Ow7GZTg+Io CGW35tiozafa6OW3kcrRbRR6Ceqj4b0bQ+z5xe1LJQx7h9UIohwD3P9vRk70wGhVzOSN VO6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=VXB3sDXLr2J/PWK7WC7SwWZiu5cXaiPOgPfes8Vb4PQ=; b=SB7A53H8HqlHchy+1yTNB85MHIcoCdF6gnm/92zfknNdKsuVtBt86erMMNyI7N0cdu uHrIkHMkXalyzoISdK1FcGyAoYhly8th+/lE2KQjnRw0Z/OV4IlGZhCCMmcISRvrNkMn J9iHunriihiQJKpTdHQrVmnxFy8/0LuH0Xm/UHpjuWUpkgutILo+4dUX553Y/gtSKLVf xVWrfPlRKZYiGx5cMnx5HnuI4UvIpH16gSm1c3ycAfoWQkUjBmTG6qieZ9V/jKwnvngh jUs7q9+X7RYX0bO3yCg7vA5SI8p3nBHrl0z2piA5wRSSu0d2jZQf+3QyUVZ49ExMvSj9 oyzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=YqooeYuG; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f3si10420795edt.290.2021.06.13.23.50.10; Sun, 13 Jun 2021 23:50:33 -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=@gmail.com header.s=20161025 header.b=YqooeYuG; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232425AbhFNGuX (ORCPT + 99 others); Mon, 14 Jun 2021 02:50:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39382 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232096AbhFNGuX (ORCPT ); Mon, 14 Jun 2021 02:50:23 -0400 Received: from mail-qk1-x736.google.com (mail-qk1-x736.google.com [IPv6:2607:f8b0:4864:20::736]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 71A7BC061574; Sun, 13 Jun 2021 23:48:08 -0700 (PDT) Received: by mail-qk1-x736.google.com with SMTP id c124so37430479qkd.8; Sun, 13 Jun 2021 23:48:08 -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=W0gXlY9piYN9wr3z9JttwuWZm9my4izmya2F3svxg4CI7/py9dU4XLp6Y9Ldhjr7xo JpymTswcxU63xKCShjEkCD836XcVEiShLlv6TWYhXMkkrIU9YUyt+BbHh2yIQpwuuD27 xNB6cTvoxV06fcSaK2aTcve9CvzLOI6XmdH69Jupf2pgnRwtPQuuesRLSEiIvi4piYQu 2SfIdPoKQWjvS82q8/9YIXAJFk7BqCCU5ggPV+Y44N9aVAjq8OoYRZxhFLFyV5MUVtMb AeeiX/N0yf4xOCPxCAxim8+vjng/mjtP61xi5MnJj6Ee2MILU94mQUJm1Sgl0PTCY/fI aDSQ== X-Gm-Message-State: AOAM5337BKtMl+GNLcK0PI56Rdl/ILgF3BaP+D3pBr9bSOsamp0vNPew EqWLU9LYMKdAYlDFZ68X1dA= 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: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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