[LTP] testcases: sysfs: Add sys_thp02
linuxtestproject.agent@gmail.com
linuxtestproject.agent@gmail.com
Thu Nov 5 16:58:33 CET 2026
Hi Xuewen,
On Thu, Nov 5, 2026 at 6:46 PM, Xuewen Wang <wangxuewen@kylinos.cn> wrote:
> testcases: sysfs: Add sys_thp02
> +/*\
> + * Sanity checks for the multi-size Transparent HugePage (mTHP) attributes
> + * exported under /sys/kernel/mm/transparent_hugepage/hugepages-*kB/.
The unescaped '*kB' after '-' in the reStructuredText doc comment is parsed
as an unclosed emphasis start-string. Use 'hugepages-<size>kB/' (matching the
next paragraph) or wrap the path in double backticks.
> + if (is_anon)
> + TST_SYSFS_ASSERT_CHOICE(enabled_allowed, NULL, 0,
> + PATH_MM_THP "/%s/enabled", dir);
> +
> + if (is_shmem)
> + TST_SYSFS_ASSERT_CHOICE(shmem_allowed, NULL, 0,
> + PATH_MM_THP "/%s/shmem_enabled", dir);
> +
> + for (i = 0; any_stats[i]; i++) {
> + TST_SYSFS_ASSERT_RANGEUU_SILENT(0, ULONG_MAX,
> + PATH_MM_THP "/%s/stats/%s",
> + dir, any_stats[i]);
> + }
> +
> + if (is_anon) {
These two 'if' statements have multi-line bodies without curly braces and
duplicate the 'if (is_anon)' and 'if (is_shmem)' blocks immediately below.
Move the TST_SYSFS_ASSERT_CHOICE() calls into the braced 'if (is_anon)' and
'if (is_shmem)' blocks below (or add curly braces).
> +static void run(void)
> +{
> + DIR *d;
> + struct dirent *ent;
> + int found = 0;
> +
> + d = TST_SYSFS_TRY_OPENDIR(PATH_MM_THP);
'found_pmd' is a file-scope static variable that is set to 1 in check_size()
and never reset at the start of run(), so it stays set across '-i'
iterations. Reset 'found_pmd = 0;' at the beginning of run().
Verdict - Needs revision
---
Note:
The agent can sometimes produce false positives although often its
findings are genuine. If you find issues with the review, please
comment this email or ignore the suggestions.
Regards,
LTP AI Reviewer
More information about the ltp
mailing list