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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id EC177C83F34 for ; Thu, 17 Jul 2025 16:15:00 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8D4CE8D000A; Thu, 17 Jul 2025 12:15:00 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8AC888D0001; Thu, 17 Jul 2025 12:15:00 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7E9848D000A; Thu, 17 Jul 2025 12:15:00 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 6B85F8D0001 for ; Thu, 17 Jul 2025 12:15:00 -0400 (EDT) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 1D2531A0166 for ; Thu, 17 Jul 2025 16:15:00 +0000 (UTC) X-FDA: 83674255560.05.317E9CE Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf06.hostedemail.com (Postfix) with ESMTP id 75862180011 for ; Thu, 17 Jul 2025 16:14:58 +0000 (UTC) Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=kkdQ8OmX; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf06.hostedemail.com: domain of sj@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=sj@kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1752768898; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=w7G/2aLN1ZMWIW06GTbepcoz67BBj8p1HITxXKHhU80=; b=4riXMjBky0scMVn4+ProjpoaxJZiYgekNRilnO1DJK8JZDBD4eRUETFNm566dQeTJEGSJN AboEF1UqdBYPizoY+hkyJ2052ZxPY8Hge463qUs1bILya8QeIuUbtpPh7+9nIoPgZCb2iu xATWfRKdnwUQUpX6mmtAtbUYdtqgOEc= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1752768898; a=rsa-sha256; cv=none; b=UmyKZ6P2tu1GZ/GyEybS/preQQwg28+RzSRYH7Gr0h4fINxrvgZ2HVPyYSEHPCxcICJlwY Z5ilKxrw10Hxiz3IvkFCsYGYd95+OqEs19zidUlskPwhgQFaan9PS/wQue1sfZZwLZyCPx YPFyg4LMJbOeeDXF4VoTxv/+VRz6C0Q= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=kkdQ8OmX; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf06.hostedemail.com: domain of sj@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=sj@kernel.org Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 5D5995C596B; Thu, 17 Jul 2025 16:14:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D8E63C4CEE3; Thu, 17 Jul 2025 16:14:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1752768897; bh=5IcsonFb86uUyqMHv9JdUoJ9pJrYwbDo0+ddHS1jofM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kkdQ8OmX06WKvymsNEyCLhOd3QjBiOamtoRblYB11i5vp2oYgso1a72NJOAoxjfYk I3bqN8zohfQqsJWuqkRFUrpRg3k5CyDrJDzkURkhXKC1iIf3S+HDUNP9ou7jRrfEKB 6lbjkv1AJ82jeugEo6R2Qcxh0Kc/IuUOJdhytv8t4Y7d7hRTlamNCoZCdKP+GZus+f pPvF6WJma9OTZJy2qGeu8b5rhaNN0yx3JdfHd0WDM4dqmxRlgplKx/eBm8Xee56blb jfmiFqShHuEkQ+m2wsSiPPOwVkzA91YJQI/OyUOrBpOB1y0ThEhn5wmyLRW1qople2 gP5dQ5h5K4mAg== From: SeongJae Park To: Joshua Hahn Cc: SeongJae Park , Enze Li , shuah@kernel.org, damon@lists.linux.dev, linux-mm@kvack.org, linux-kselftest@vger.kernel.org, enze.li@gmx.com Subject: Re: [PATCH] selftests/damon: introduce _common.sh to host shared function Date: Thu, 17 Jul 2025 09:14:54 -0700 Message-Id: <20250717161454.62245-1-sj@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250717135433.2113596-1-joshua.hahnjy@gmail.com> References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 75862180011 X-Stat-Signature: u67ifzrtuayu84ok4zwsq4zbfagqe33i X-Rspam-User: X-Rspamd-Server: rspam11 X-HE-Tag: 1752768898-60794 X-HE-Meta: U2FsdGVkX1/k3GOhh9jfHvgrRykZGTKuJkQM2i/92cR/5uTtclhgmk7Ewwtfia4KHsTlEXA+WI8IK2hMM5d4JI8QF4DdeHiQfLefcP/b8Cyat9Vg/5yMvk0U+7oUPPPr7Uth2hocJi7bT8GQV5RVQHNV/B1rDmFP+PfzlsH02kuzlhdev/2hILS3BtevxkW01kJ991KYLdTl5f6F3brg4FHB6yahFi0Iq/vrMLGVO85seLjlXZ4DUfM9YlsLeIA/rsiX3Lzk/RMM0g9JKCLLN7EXG8kE+iymB2CJE5vQPMlSlvQfYJDhVJU43CuZ8U9Q+6bGNHd22I4Z47WAXEmXsvkKZpDmTo6VlhJEwuGD+3/aokGr3qeNAZDsqOG0xTz/Hs3fhRa2WNUM70v0o1F5WCaFTYuzF4U80WcVE6LAxue7BcjmBEMeofA1FiFgMYJwVqPx0lTXRiWgpAJigW8G8Fn12s2YFMxkvX1ut1IFs462nc5JtzjQjRB3AodMygGDPswsz+co/LrXtltZ5XDhUSiuUHXcbJH33pBYnlSmhKjpd3627Hn9JhRDmawVSUeXriRkx2rwRFyUJVBNXIc3klcwkXM5Zeec1botLAyGugagf2uf9NiVjY+Te1ng7VB7gTWVC9hTgEdimvnGNlEy6dTcv6fIu+NdlXplEqGoSg1x5M9qQHKXq09vkmKPzo6Bs+YF+wlL+yMQsFeapNniSX3MIVG//08ZneiD8cT/ZVNw1tWvV5kU3fooJ3Gp3zS3FzgUUO4tH2DkQ/OQZWS1wfxIcGQtY24Pumhe1ul0VZLDBQZ+/JvHp+g/de8b8O5gZuURf632K/mKsNNKmnVNsRd4DTVNXQa67SG0Vi4uoUiZjiR74UWXoB2nZPmIAJYIVsQFhasyG11KuDs11fdvPb/BkyidxNRxFLr1CjxrLtQ4k81nn5Qy2WzXk/F6fego68/rWou7xwBrPkbVWjG S1WOQjk7 TRyBJQhL9FLoK0SZElz9FuTFBOyaVl/gqG8kB0yzVsLaIfD1g+DHX2Tx01VO7Rjto9rt4Chxhi7zP0EXMaq6PGU6f1/d6B1qE9YvhcSCpxEGHdx4XPJUDFE9+JoUsmTD4/kRNHvaNSdNHdvR0bevlMKcTwfgxQlYDSul9SeWFHj6iilCaARcQ5NEd2Qq4MbQTxAGTQqK+jEYAnC2UHbq7t1ryfnXAwhD2FLWlPqNnPwt7Mw+YHHb+uxlJCYfpZMuifaKizuh2lmtiiSJVdFEieBE8XDJ0ELVyqUJ/8R8FqDvpsjSGVnsYKxTluGYye3+jppc1w8SGX5Fqg5kRDXzsvQnTZERZ6thAPE98 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: List-Subscribe: List-Unsubscribe: Hi Joshua, On Thu, 17 Jul 2025 06:54:32 -0700 Joshua Hahn wrote: > On Thu, 17 Jul 2025 17:19:02 +0800 Enze Li wrote: > > Hi Enze, > > Thank you for the patch! I just have a few comments about the patch. > > > The current test scripts contain duplicated root permission checks > > in multiple locations. This patch consolidates these checks into > > _common.sh to eliminate code redundancy. > > Is there a reason we named the file _common.sh? IIRC there are no other files > that begin with an underscore, so it might be confusing for users. Maybe > remaining it to damon_common.sh might fit better with the convention used > by other selftests. This is my personal pattern that I sometimes use, to distinguish files that aimed to be only indirectly be used. We already have a file of the pattern, namely _damon_sysfs.py. I don't think this pattern is particularly good, but not making something worse, so I'm ok with current file name. > > [...snip...] > > > diff --git a/tools/testing/selftests/damon/_common.sh b/tools/testing/selftests/damon/_common.sh > > new file mode 100644 > > index 000000000000..3920b619c30f > > --- /dev/null > > +++ b/tools/testing/selftests/damon/_common.sh > > @@ -0,0 +1,14 @@ > > +#!/bin/bash > > +# SPDX-License-Identifier: GPL-2.0 > > + > > +# Kselftest frmework requirement - SKIP code is 4. > > +ksft_skip=4 > > + > > +check_dependencies() > > +{ > > + if [ $EUID -ne 0 ] > > + then > > + echo "Run as root" > > + exit $ksft_skip > > + fi > > +} > > diff --git a/tools/testing/selftests/damon/lru_sort.sh b/tools/testing/selftests/damon/lru_sort.sh > > index 61b80197c896..0d128d809fd3 100755 > > --- a/tools/testing/selftests/damon/lru_sort.sh > > +++ b/tools/testing/selftests/damon/lru_sort.sh > > @@ -1,14 +1,9 @@ > > #!/bin/bash > > # SPDX-License-Identifier: GPL-2.0 > > > > -# Kselftest framework requirement - SKIP code is 4. > > -ksft_skip=4 > > Hm, I think factoring out check_dependencies() is a good idea, but maybe we > should keep ksft_skip in here since other checks in the script use the value? > My 2c is that it might make it unnecessarily opaque for others. > Same comment applies for the other files as well. > > But I will let SJ comment on this more ;) I agree Joshua's point. I'd prefer keeping ksft_skip definition here. > > Thank you for your patch, I hope you have a great day! Thank you for your valuable comments, Joshua :) Thanks, SJ [...]