From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-dl1-f52.google.com (mail-dl1-f52.google.com [74.125.82.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id ED740391E54 for ; Mon, 13 Apr 2026 07:45:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.52 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776066336; cv=none; b=I9DpFUfkLtLaQHztXi96OKhCRVqJV/Be23T7LJy4VLPKhT89jFfD2pFANB5E+qMtR3VeUbgn1SY3d/jFI6XXEzuQRqWt1JThJo2MKuM6e1T1UKMdX9qE+IQF3DDWsG8BVDT5UbfUkDJCDvpUPUzSXaIBDsUvvY7PrR6H1x/FBJ8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776066336; c=relaxed/simple; bh=haYoKxwnQ4IkliWshHCYCJwKmzDfLZJY0fIFa30X7D0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=bpAAQsC0f8qr9d8Sm2YYew0x9HtdNSUcHxWeIh22erlxShZgRJf8f2GKW3ovqywNwfYH2ZKpqNURLpfZrp7IfMoN/DbLnHirj6au7SNv60/qG5WsmQd2Gp6z5eXwSCmhnFUgUAB/qvIOAy+Sk26UdzL+glepbdbMVEdNJrBbk5Y= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=JtNutOjz; arc=none smtp.client-ip=74.125.82.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="JtNutOjz" Received: by mail-dl1-f52.google.com with SMTP id a92af1059eb24-1271195d2a7so5345348c88.0 for ; Mon, 13 Apr 2026 00:45:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1776066334; x=1776671134; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=I5M3+b2z7keZbGNN1L4pc5gbCusIv4rK3WbERlRAtRw=; b=JtNutOjzO9oL5iDsdBC2WRURLvOza8Hnh48XnYRktcHQj0XMOlIFZv7BP4/GAv1p9d jzUctCWVdvbcpeoHI/bSYVebPKQVNJE8+AnoT8b3T7ENh8N2A0IhXRHLgXUS7/y1akHG m5KfcN4WQYfa/WEVarvT9NSh51qmOQbT8m6xpP/RbJcHDxgYfbet1z14ouOv9HN3UbvD LlAqgrsVcUXQHURb6mlYqNeO9lAYdMCmiNYvkUnfof05zveFEfF8VFiVLxuqYHy99dhH SMEaWYH4zOvN70tMNyrh+no03GZUN1b9/5zXWtU6XjkeGVk9hgQwuU+8MdGN11BJSq5E a4kQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776066334; x=1776671134; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=I5M3+b2z7keZbGNN1L4pc5gbCusIv4rK3WbERlRAtRw=; b=naASyO4AqxRkgWWdqAsqdwEDBJGwnjF5IPBkhAsorvGIVZUDsquii6IzoialTW6sp0 Oqb3WFYqpi+R2IC32Ri2LTOPJVMirDO0zHXqNVjhzGyv/XzgXxvTWGiV+xVfU3vwf/mM xifI0dHFpfnHZymnMe323U7QFRzNFx1PqryZyQiiU9XfFqK14t0B3UvB+wgmAHSEN9fj D1TX1WY8IQZ8cbeWd5KlbQjmiTylpNIzTi2lnhld5odna59AfzppmCu9POybTZ/PoTb+ NmZUlGOjRkrft11X8/nq15v7yZHTaM65rt6E1lFxnjBHw00SUfLUDDVAKR/qdVWf02Jw lLTw== X-Gm-Message-State: AOJu0YzckE5t4I78bl2s0P3/myfzad1hXR8LXyyAIefX/o4Yw1lWrDSU 8DFuX2Yuhwb7CtUuRSMXsyxkqM753PDBehdqFabI5cgSQZ0PFSHjnuss X-Gm-Gg: AeBDietGIBM8aftLBm/RVtGuotshn6fXJw06OWNSNSIx7ZjjC0jPcCmn8zEoVVBAnCm v+OztGxGJBkWYc2VYpF2wxJwvJI1iL/NSzRbAb28rsTJTWFH1FLuzyP0QzOeM+ZOeZW/pKIghgI G13uSlGrhy75Lg+3c7bGxebLIXaLfwmS2MCKrM1QaLjzDS4Ksb3vpVZjZM05ZS/FtUAemc8K1VA BklFnZvscs/Ou6OoyYYw9eZknvcs8FikwKFqipp8CvqCAYPy/ZHG/f7GVJfdJI9npZKaHVw8d+i NJnVRL7pNke2/N11h3fzohdtNazrK/grc8ZAZE6hizvnOYVH4ZoKIUHooGc30Mc/tcGU7ZTYY07 nXyBYstE6/ExoRsDec9TohjPYf0OUxt6Wwn58fN2t1Tm9BwDRCqCe5Ec0MBt1fO1MiNpdTUpvcz MBSh9Idl7KwmWpDjWE X-Received: by 2002:a05:7022:e1b:b0:128:d107:da0f with SMTP id a92af1059eb24-12c34ea9471mr6689826c88.10.1776066333988; Mon, 13 Apr 2026 00:45:33 -0700 (PDT) Received: from wujing. ([74.48.213.230]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-12c347fa2c9sm12884610c88.15.2026.04.13.00.45.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Apr 2026 00:45:33 -0700 (PDT) From: Qiliang Yuan Date: Mon, 13 Apr 2026 15:43:18 +0800 Subject: [PATCH v2 12/12] selftests: cgroup: Add functional tests for dynamic housekeeping Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20260413-wujing-dhm-v2-12-06df21caba5d@gmail.com> References: <20260413-wujing-dhm-v2-0-06df21caba5d@gmail.com> In-Reply-To: <20260413-wujing-dhm-v2-0-06df21caba5d@gmail.com> To: Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Valentin Schneider , "Paul E. McKenney" , Frederic Weisbecker , Neeraj Upadhyay , Joel Fernandes , Josh Triplett , Boqun Feng , Uladzislau Rezki , Mathieu Desnoyers , Lai Jiangshan , Zqiang , Anna-Maria Behnsen , Ingo Molnar , Thomas Gleixner , Tejun Heo , Andrew Morton , Vlastimil Babka , Suren Baghdasaryan , Michal Hocko , Brendan Jackman , Johannes Weiner , Zi Yan , Waiman Long , Chen Ridong , =?utf-8?q?Michal_Koutn=C3=BD?= , Jonathan Corbet , Shuah Khan , Shuah Khan Cc: linux-kernel@vger.kernel.org, rcu@vger.kernel.org, linux-mm@kvack.org, cgroups@vger.kernel.org, linux-doc@vger.kernel.org, linux-kselftest@vger.kernel.org, Qiliang Yuan X-Mailer: b4 0.13.0 This extends the cgroup v2 testing framework in selftests to validate the newly added Dynamic Housekeeping Management (DHM) cpuset interface: `cpuset.housekeeping.cpus` and `cpuset.housekeeping.smt_aware`. The `test_cpuset_housekeeping` functional test verifies: - Validation of DHM's SMT safety guard (`cpuset.housekeeping.smt_aware`) by ensuring writing to it behaves as expected. - Basic read and write capabilities of `cpuset.housekeeping.cpus` using the base CPU mask. If the DHM functionality is not present in the kernel, the selftest skips gracefully. Signed-off-by: Qiliang Yuan --- tools/testing/selftests/cgroup/test_cpuset.c | 36 ++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/tools/testing/selftests/cgroup/test_cpuset.c b/tools/testing/selftests/cgroup/test_cpuset.c index c5cf8b56ceb8f..b2a032be4407a 100644 --- a/tools/testing/selftests/cgroup/test_cpuset.c +++ b/tools/testing/selftests/cgroup/test_cpuset.c @@ -232,6 +232,41 @@ static int test_cpuset_perms_subtree(const char *root) return ret; } +static int test_cpuset_housekeeping(const char *root) +{ + char buf[PAGE_SIZE]; + int ret = KSFT_FAIL; + + /* If the kernel doesn't have DHM patch, skip */ + if (cg_read(root, "cpuset.housekeeping.cpus", buf, sizeof(buf))) + return KSFT_SKIP; + + /* Test writing 1 and 0 to smt_aware */ + if (cg_write(root, "cpuset.housekeeping.smt_aware", "1")) + goto cleanup; + + if (cg_read_strstr(root, "cpuset.housekeeping.smt_aware", "1")) + goto cleanup; + + if (cg_write(root, "cpuset.housekeeping.smt_aware", "0")) + goto cleanup; + + if (cg_read_strstr(root, "cpuset.housekeeping.smt_aware", "0")) + goto cleanup; + + /* Read root cpuset.cpus.effective */ + if (cg_read(root, "cpuset.cpus.effective", buf, sizeof(buf))) + goto cleanup; + + /* Write it back to housekeeping.cpus */ + if (cg_write(root, "cpuset.housekeeping.cpus", buf)) + goto cleanup; + + ret = KSFT_PASS; + +cleanup: + return ret; +} #define T(x) { x, #x } struct cpuset_test { @@ -241,6 +276,7 @@ struct cpuset_test { T(test_cpuset_perms_object_allow), T(test_cpuset_perms_object_deny), T(test_cpuset_perms_subtree), + T(test_cpuset_housekeeping), }; #undef T -- 2.43.0