From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1CC45606A333 for ; Sat, 5 Dec 2026 17:33:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=hVeQqmhy Received: by kanga.kvack.org (Postfix) id 736D06B05BD; Sat, 5 Dec 2026 12:33:14 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 70EFA6B05BE; Sat, 5 Dec 2026 12:33:14 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6257F6B05BF; Sat, 5 Dec 2026 12:33:14 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 3C03C6B05BD for ; Sat, 5 Dec 2026 12:33:14 -0500 (EST) Received: from smtpin17.hostedemail.com (lb01a-stub [10.200.18.249]) by unirelay09.hostedemail.com (Postfix) with ESMTP id AACE8806EB for ; Sat, 5 Dec 2026 17:33:13 +0000 (UTC) X-FDA: 85510625466.17.89E779F Received: from sea.source.kernel.org (sea.source.kernel.org [172.234.252.31]) by imf15.hostedemail.com (Postfix) with ESMTP id 070EBA0007 for ; Sat, 5 Dec 2026 17:33:11 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20260515 header.b=hVeQqmhy; spf=pass (imf15.hostedemail.com: domain of sashiko-bot@kernel.org designates 172.234.252.31 as permitted sender) smtp.mailfrom=sashiko-bot@kernel.org; dmarc=pass (policy=quarantine) header.from=kernel.org ARC-Seal: i=1; a=rsa-sha256; d=hostedemail.com; s=arc-20220608; cv=none; t=1796491992; b=p7oK4+ykLtTqmyS+3mfG1WfruozcNP2KdMAPu2FIGbwmk8mf5uLlSnSJZL5lUqA3VeQWm5 1xBlvhX+sbAdceMm7eIna6OfTRlROdl9EVQck9C80gPrX/ptFRB+ET1OFHaxvjZxjOCbWw zmAh/8Ljd/uFYZ+jwkT7ggTht2xVmNE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1796491992; h=from:from:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=w+aCvjsMc9JFRpqducmJkWDN6I87Sk/RTjuyuYbTqSY=; b=2VOGKLtp+OoNYgsWSVoXqKN4SXGzwNybpiMR8tPCMD+eivYXKQw49arRFVFFuJQN8zrQTF 4kcX+i1mNVoH5Z/sr7GAKrGWSqvPTj76N2yIgEL45i14XU2ErntaBZBHH72z4SJQ2MptAF IBZywcO2dFeGHE1yiR/pJBv0NHYOfa4= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20260515 header.b=hVeQqmhy; spf=pass (imf15.hostedemail.com: domain of sashiko-bot@kernel.org designates 172.234.252.31 as permitted sender) smtp.mailfrom=sashiko-bot@kernel.org; dmarc=pass (policy=quarantine) header.from=kernel.org Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by sea.source.kernel.org (Postfix) with ESMTP id 55E8243A2E; Sat, 5 Dec 2026 17:33:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9D8681F0092B; Sat, 5 Dec 2026 17:33:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796491991; bh=w+aCvjsMc9JFRpqducmJkWDN6I87Sk/RTjuyuYbTqSY=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=hVeQqmhyPsU7h2PyTPXJg0RfE+W/A8Yev7jxlwY5O2tHA3eXHrDkn9P6U+IDkEG4e /GWTgMBWr5By9hHOmocVytduAsqw05MePwEfluryOR/Kyr7b4M4QD1LYGnT53Bm68i LOUip/PYXtY4Hhn3FWpRzrUsOe4ZfQFfwJng5LM0cjwWFrXhyfy0UubXWfvktdZ+fO 42LpPO7r0f3VHI7Jc27hVc4A94ck9I8xBymV4ckBHO2TkJIgQADLt/SJ0DVvUTahpH 3Y8nzc7eA3jyKgD402Tynv4kgxcES370rRLAY1ddlWm4sLbjf8CbLUznCxK9DN6n7x iOM0L0wwfgdgA== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH 4/4] selftests/mm: fix and enable the multiple cgroups hugetlb tests Reply-To: sashiko-reviews@lists.linux.dev To: "Kurt Lin" , "Andrew Morton" Cc: "David Hildenbrand" , "Liam R. Howlett" , "Vlastimil Babka" , "Mike Rapoport" , "Michal Hocko" , "Shuah Khan" , "Mina Almasry" , "Sayali Patil" , "Zi Yan" , "Song Hu" , linux-mm@kvack.org, "Li Wang" In-Reply-To: <20261205-hugetlb-charge-multi-cgroup-v1-4-e88105afc12a@gmail.com> References: <20261205-hugetlb-charge-multi-cgroup-v1-0-e88105afc12a@gmail.com> <20261205-hugetlb-charge-multi-cgroup-v1-4-e88105afc12a@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Sat, 05 Dec 2026 17:33:10 +0000 X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 070EBA0007 X-Rspam-User: X-Stat-Signature: 5fpx8qqb5yfnpsfuqcdqzy5a4q7z8bae X-Spam-Status: No, score=-11.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=4.0.1 X-HE-Tag: 1796491991-720866 X-HE-Meta: U2FsdGVkX1/GkJVW0B9T0XSTE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EKVNNmWbuTZfza6O7HuAwAO1Gnlq4ai22QwpiRbkMACsmhLgrh9B9qso4yIbk8ndcGCEvAox8J/tTfVUnvSGwf4Tx7YEdtsNFWK2L3P678ZSTIZXG42WXT559ANUaHqSGJI6pdN2HuOWcbkclSqBdTg+0MpjDPdRMAWFoxIYLsKkonmK6p2TgM9PRYlFYqZYt2EeK8GjP9w4uJ9yi2sPsEV1plXTe9EAxXJfxeP25/tQhvBuPQfKrX4HPcDW3OEhHy1ZgYIf+7qe9cbgs2acm3w261Zj/nYHaURRPz8rs5TePNHwylGgsNjQ6BcnXwl7lfmA0cRfr/01zc7Gbeo6cC621XUDOa/h//R4chxw+7wfAh0qQR2z6nPaQYklcdmq7nGNEUkU1IioTRFxLmsSFUhqDbraSNb7WpJullKKskW5zIRDYGSWGdyjzrw9Z6YZIDheQRd3x7lYXUxhl5IHx8DrKrCeigxJaAQTrHGDpjT/qVZs2JAfQ/Y1FrOMpkya0JLZkXumh687pAIo/Khnpr293XJLOvmNUFw73d+t0yCFkXmOHfsaoO9SFLWNuZURw2ym1kmZTy6CAmltPFo+F9cw1sJbUhKf8nqmyg9VbkcO4CQylT4DhQViR1MKISjCDHrIcSZ14qgaTL2y38249V4dQxYrmz/MI6WvabXUDEtG99K5pxiQRVkfS Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 X-Archived-By: Thank you for your contribution! Sashiko AI review found 2 potential issues to consider: - [Low] selftests/mm: run_multiple_cgroup_test() leaks writers on failure exit - [Low] selftests/mm: cleanup_hugetlb_memory() wait loop races with umount and rmdir -- commit c995fb54b97ee185014857c42d52be9482317eb8 Author: Kurt Lin selftests/mm: fix and enable the multiple cgroups hugetlb tests This commit converts page counts to bytes in run_multiple_cgroup_test() and its assertions, fixes its local path variable declarations, passes both test cgroups to cleanup_hugetlb_memory(), and removes the continue that skipped the multiple cgroups test. > diff --git a/tools/testing/selftests/mm/charge_reserved_hugetlb.sh b/tool= s/testing/selftests/mm/charge_reserved_hugetlb.sh > index e43b7bc1ad1b9..ca84c353e28fe 100755 > --- a/tools/testing/selftests/mm/charge_reserved_hugetlb.sh > +++ b/tools/testing/selftests/mm/charge_reserved_hugetlb.sh > @@ -283,14 +283,16 @@ function write_hugetlbfs_and_get_usage() { > =20 > function cleanup_hugetlb_memory() { > set +e > - local cgroup=3D"$1" > + local cgroup > if [[ "$(pgrep -f write_to_hugetlbfs)" !=3D "" ]]; then > echo killing write_to_hugetlbfs > killall -2 write_to_hugetlbfs > while pgrep -f write_to_hugetlbfs > /dev/null; do > sleep 0.1 > done > - wait_for_hugetlb_memory_to_get_depleted $cgroup > + for cgroup in "$@"; do > + wait_for_hugetlb_memory_to_get_depleted $cgroup > + done > fi > set -e [Severity: Low] Can the pgrep wait loop in cleanup_hugetlb_memory() exit before the writer finishes closing files and detaching from its cgroup? In do_exit(), exit_mm() clears tsk->mm and uncharges hugepages before exit_files() closes /mnt/huge descriptors and before do_cgroup_task_dead() removes the task from its cgroup: cleanup_hugetlb_memory() write_to_hugetlbfs (do_exit) killall -2 write_to_hugetlbfs exit_mm() clears tsk->mm; uncharges pages pgrep -f write_to_hugetlbfs -> 1 wait_for_hugetlb_memory_... -> 0 umount /mnt/huge <-- EBUSY exit_files() exit_notify() do_cgroup_task_dead() Once tsk->mm is cleared, /proc//cmdline is empty and comm is truncated to 15 characters, so pgrep -f write_to_hugetlbfs stops matching. umount /mnt/huge or rmdir in cleanup() can then fail with EBUSY under set -e. write_hugetlb_memory.sh also writes its own PID to cgroup.procs and runs write_to_hugetlbfs without exec, so rmdir can hit EBUSY while the wrapper shell is still exiting. Waiting for the background PIDs or for cgroup.procs to empty before unmounting would close both races. [ ... ] > @@ -418,7 +418,7 @@ function run_multiple_cgroup_test() { > expect_equal "$reservation_usage_before_second_write" \ > "$(cat $cgroup1_reservation_usage)" "Reservation usage changed." > =20 > - cleanup_hugetlb_memory > + cleanup_hugetlb_memory "hugetlb_cgroup_test1" "hugetlb_cgroup_test2" [Severity: Low] Does run_multiple_cgroup_test() leak background write_to_hugetlbfs processes when expect_equal() fails? On failure, expect_equal() calls cleanup() and exits before cleanup_hugetlb_memory() stops the sleeping writers. cleanup() does not kill write_to_hugetlbfs, so umount /mnt/huge and rmdir fail with EBUSY under set -e, leaking writers, hugepages, mounts, and cgroups. The same leak happens if the second write_hugetlbfs_and_get_usage() detects a dead writer and calls cleanup() while the first writer is still alive. Checking cgroup1 usage after cleanup_hugetlb_memory(), or killing lingering writers in cleanup(), would avoid leaving them behind. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261205-hugetlb-ch= arge-multi-cgroup-v1-0-e88105afc12a@gmail.com?part=3D4