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 506E2C83F1A for ; Fri, 18 Jul 2025 06:28:04 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C2D528D0003; Fri, 18 Jul 2025 02:28:03 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BDE008D0001; Fri, 18 Jul 2025 02:28:03 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B1AE68D0003; Fri, 18 Jul 2025 02:28:03 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id A682B8D0001 for ; Fri, 18 Jul 2025 02:28:03 -0400 (EDT) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 5A68F16033C for ; Fri, 18 Jul 2025 06:28:03 +0000 (UTC) X-FDA: 83676405246.03.A506862 Received: from mailgw.kylinos.cn (mailgw.kylinos.cn [124.126.103.232]) by imf03.hostedemail.com (Postfix) with ESMTP id 27A7420008 for ; Fri, 18 Jul 2025 06:27:59 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; spf=pass (imf03.hostedemail.com: domain of lienze@kylinos.cn designates 124.126.103.232 as permitted sender) smtp.mailfrom=lienze@kylinos.cn ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1752820081; a=rsa-sha256; cv=none; b=OjFdQncm6ce6b768tKXWFzUuCi6/Xs/xUAhhQQpvExs6gEXns/B5PdisAPD6JdC5X7Btyk fa/0dk1nmsIPRwCXUCTL1L6eevyxVLzdah0NicPz9rZQv2FCAtjEaXCnEg1EtAeb9F0unQ AZiwBc+jrO1kCRR7coUbSbTCKjBS3AI= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf03.hostedemail.com: domain of lienze@kylinos.cn designates 124.126.103.232 as permitted sender) smtp.mailfrom=lienze@kylinos.cn ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1752820081; 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-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=jAlQL2wUQX3X+LOIwBxGNU1/Yr05CdEwQi0MV948/bI=; b=lB/cSW5AX8mz8ljILwuQUmDbQuiBntWuMdM7UkAsDk9AxQVHDBMzfeszH2b88WfsD2jXHO 7I2XmrsXV7wAWXbdSSyTk96QHXIrb3bdSOr5RVm2foLeRz3nq+DI6tpSUD0GTt+JiGEhAD Fts+mk12A7jJHcCSI70Pf/EbVNTWezo= X-UUID: 553cefd863a011f0b29709d653e92f7d-20250718 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.45,REQID:0555c4eb-0c45-4a6e-9089-85163eb6ee26,IP:10, URL:0,TC:0,Content:0,EDM:0,RT:0,SF:-15,FILE:0,BULK:0,RULE:Release_Ham,ACTI ON:release,TS:-5 X-CID-INFO: VERSION:1.1.45,REQID:0555c4eb-0c45-4a6e-9089-85163eb6ee26,IP:10,UR L:0,TC:0,Content:0,EDM:0,RT:0,SF:-15,FILE:0,BULK:0,RULE:Release_Ham,ACTION :release,TS:-5 X-CID-META: VersionHash:6493067,CLOUDID:46f8f2ff3d95a167e0444120511bf509,BulkI D:250717215444LBUIQCD2,BulkQuantity:2,Recheck:0,SF:17|19|24|44|64|66|78|80 |81|82|83|102|841,TC:nil,Content:0|50,EDM:-3,IP:-2,URL:0,File:nil,RT:nil,B ulk:40,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV:0,LES:1,SPR:NO,DKR:0,DKP:0,BRR: 0,BRE:0,ARC:0 X-CID-BVR: 0 X-CID-BAS: 0,_,0,_ X-CID-FACTOR: TF_CID_SPAM_FSD,TF_CID_SPAM_FSI,TF_CID_SPAM_SNR,TF_CID_SPAM_FAS X-UUID: 553cefd863a011f0b29709d653e92f7d-20250718 X-User: lienze@kylinos.cn Received: from kylin [(223.70.159.239)] by mailgw.kylinos.cn (envelope-from ) (Generic MTA with TLSv1.3 TLS_AES_256_GCM_SHA384 256/256) with ESMTP id 408332628; Fri, 18 Jul 2025 14:27:52 +0800 From: Enze Li To: SeongJae Park Cc: Joshua Hahn , 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 In-Reply-To: <20250717161454.62245-1-sj@kernel.org> (SeongJae Park's message of "Thu, 17 Jul 2025 09:14:54 -0700") References: <20250717161454.62245-1-sj@kernel.org> Date: Fri, 18 Jul 2025 14:27:48 +0800 Message-ID: <87jz46rp23.fsf@kylinos.cn> MIME-Version: 1.0 Content-Type: text/plain X-Rspamd-Queue-Id: 27A7420008 X-Stat-Signature: ibosny4jgw4ctpcgqrawiqtw8wxeoszn X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1752820079-888560 X-HE-Meta: U2FsdGVkX1+udQPiZ8DEAlKIXzSY6izDOmTab+KIzyyqruBWaWvb0hPvL3srggByd6ls8ea9DZ0FLKBKQP+NEnRUTSdDhhEB3izZIvi6rG8SIegDamFjAuWE4vYNvG/M3mZ+z80J6s6nFRsJp3rc0WPKvUlnX5GcjBOzU6+2OSEmiqBJUNQFhGMsp+0Npti/hkM7/KVAK3Dat7R2IG8awQ1m6CIi6bGBTM0SgieEpTva+Fulhx6DGRn/0P9k3wefHGDt7WVATu0VOsA2nzOJYU2IdqMUR0azCy3F/42yFc1v4gyf/ePShRUXQ/RGy64rnL47d57AWR55frr/XNYkXPA2GhwE8/en35GyRJeK0Y3eOjOtdC15CITpeZCXehv+k5Mi1uP+v3chEgKrlJVa418rY/K45IMR02W/aNrNHpItS8Ht5WAbY3RpOIzwy5MF0SvEiir3+Bp4cP9ZvD/7CJfro3rPZxCi0HoHvaYZkd9vXxaicjth0cGGpniOyFanESPNxg85SBXUQb6gkQd/bfb4CgMTkGomPqAKcQ0gbOVAPxtyxaa/RVo/K5IFdmhYeFq1EWLofqj3Dj6t3o5xOABu680a75CO897gidZbmBKlgF7/icT7jckgX5ozFMN+WSpWdZ521QJ8UG+YJj2CT0Ha96cOpGioSx58PC5x/r/zm2C9ml+4LpptyH5zlz5J6qPwVyB+guFt5kn4OD6fiWQNtXZCISj3TbIuCy9fh4tCqE6lpEIW7wCC3GfFeuhIkzV4Pc+BGTSpH47jKP7LUAHs21p/XnnsUvxzBU72/fCPe88OANHhjZ78IKAdC4kRFm9b+p7xsWaAk9GdCq8bqmQXrRZC5RgUEZxCi06temQZySICELlwlO76CrLmAIeH/mlR86pkRGCevZJMIhcMig+w1xep5FtS1xDdrKDFYwPHmYF4yYAfI7A+pVChle+Ae3ZwpxZ6kM8aQNmrvc4 OtdYwDTR 4g7Yxf3CGNQymNHv/IYZlCpFkptrQGU0Dfxe03eCpsE1mbSlXbRA4+zey2yYzmR4VQ0jVb5ZPdTaZM9PDKGg8brd8PG3RPfD/8MVQURiteBph4nApPPgSp/hWFGTjK4j2J8eK/JiaI/Lnzbo= 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 SJ, Joshua, On Thu, Jul 17 2025 at 09:14:54 AM -0700, SeongJae Park wrote: > 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. Yes, I've noted the naming convention from _damon_sysfs.py and have maintained consistency with the existing pattern in this patch. :) > >> >> [...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 the review. I'll send v2 addressing your comments to the list soon. BR, Enze >> >> Thank you for your patch, I hope you have a great day! > > Thank you for your valuable comments, Joshua :) > > > Thanks, > SJ > > [...]