Linux Test Project
 help / color / mirror / Atom feed
* Re: [LTP] hugetlb/hugemmap: add hugemmap33 to test hugetlbfs quota accounting
  2026-07-17 16:02 [LTP] [PATCH] " Pavithra
@ 2026-07-17 17:15 ` linuxtestproject.agent
  0 siblings, 0 replies; 11+ messages in thread
From: linuxtestproject.agent @ 2026-07-17 17:15 UTC (permalink / raw)
  To: Pavithra; +Cc: ltp

Hi Pavithra,

On Fri, 17 Jul 2026, Pavithra wrote:
> hugetlb/hugemmap: add hugemmap33 to test hugetlbfs quota accounting

> +// SPDX-License-Identifier: LGPL-2.1-or-later

All LTP tests use GPL-2.0-or-later. LGPL-2.1-or-later is wrong here.
Every other test in this directory (hugemmap32.c, hugemmap34.c, ...) uses
GPL-2.0-or-later, as does the required test structure template.

> +	if (mount("none", quota_mnt, "hugetlbfs", 0, mount_opts) == -1) {
> +		if (errno == ENODEV)
> +			tst_brk(TCONF, "hugetlbfs not supported");
> +		tst_brk(TBROK | TERRNO, "mount() failed");
> +	}
> +	quota_mounted = 1;

The ENODEV branch is unreachable: the test already sets .needs_hugetlbfs = 1,
so the framework validates and mounts hugetlbfs at MNTPOINT before setup()
runs. Since MNTPOINT is successfully mounted, ENODEV cannot occur on the
quota mount. Use SAFE_MOUNT() instead:

    SAFE_MOUNT("none", quota_mnt, "hugetlbfs", 0, mount_opts);

> +static struct tst_test test = {
> +	.needs_root = 1,
> +	.mntpoint = MNTPOINT,
> +	.needs_hugetlbfs = 1,
> +	.forks_child = 1,
> +	.setup = setup,
> +	.cleanup = cleanup,
> +	.test_all = run_test,
> +	.hugepages = {2, TST_NEEDS},
> +};

Both the commit message and the doc comment describe this test as checking
for regressions in hugetlbfs quota accounting. Regression tests must include
a .tags entry in struct tst_test.

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

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [LTP] hugetlb/hugemmap: add hugemmap33 to test hugetlbfs quota accounting
  2026-08-09 15:15 [LTP] [PATCH v3] " Pavithra
@ 2026-08-09 15:34 ` linuxtestproject.agent
  0 siblings, 0 replies; 11+ messages in thread
From: linuxtestproject.agent @ 2026-08-09 15:34 UTC (permalink / raw)
  To: Pavithra; +Cc: ltp

Hi Pavithra,

On Aug 9, 2026, Pavithra wrote:
> hugetlb/hugemmap: add hugemmap33 to test hugetlbfs quota accounting

Verdict - Reviewed

---
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

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [LTP] hugetlb/hugemmap: add hugemmap33 to test hugetlbfs quota accounting
  2026-08-09 16:22 [LTP] [PATCH v3] " Pavithra
@ 2026-08-09 16:38 ` linuxtestproject.agent
  0 siblings, 0 replies; 11+ messages in thread
From: linuxtestproject.agent @ 2026-08-09 16:38 UTC (permalink / raw)
  To: Pavithra; +Cc: ltp

Hi Pavithra,

On Sun, 9 Aug 2026, Pavithra wrote:
> hugetlb/hugemmap: add hugemmap33 to test hugetlbfs quota accounting

> 		if (expected == QUOTA_FAIL &&
> 		    (errno == ENOMEM || errno == ENOSPC)) {

Could these checks require ENOMEM rather than also accepting ENOSPC?
The documented behavior is ENOMEM, and hugetlbfs_file_mmap() deliberately
returns ENOMEM when hugetlb_reserve_pages() rejects the reservation.
Accepting ENOSPC here and in the COW check can hide an errno regression.

> 	a = mmap(NULL, size, PROT_READ | PROT_WRITE, mmap_flags, fd, 0);

Could this and the second tested mmap() call use TESTPTR() or an appropriate
TST_EXP_* wrapper? Subject syscalls should use the LTP result macros so the
return value and errno are captured consistently.

> 	char path[PATH_MAX + 32];

Could this use PATH_MAX? LTP path buffers should use PATH_MAX rather than a
custom larger size, and this constructed path is already bounded.

> +/hugetlb/hugemmap/hugemmap33

Could this entry move to
testcases/kernel/mem/hugetlb/hugemmap/.gitignore? New test binaries should be
ignored in their own leaf test directory rather than a parent directory.

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

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [LTP] hugetlb/hugemmap: add hugemmap33 to test hugetlbfs quota accounting
  2026-08-09 17:49 [LTP] [PATCH v4] " Pavithra
@ 2026-08-09 18:42 ` linuxtestproject.agent
  0 siblings, 0 replies; 11+ messages in thread
From: linuxtestproject.agent @ 2026-08-09 18:42 UTC (permalink / raw)
  To: Pavithra; +Cc: ltp

Hi Pavithra,

On Aug 9, 2026, Pavithra wrote:
> hugetlb/hugemmap: add hugemmap33 to test hugetlbfs quota accounting

> +/hugetlb/hugemmap/hugemmap33

Could this entry be placed in
testcases/kernel/mem/hugetlb/hugemmap/.gitignore instead? New test binaries
are required to be ignored in their own test directory rather than in the
parent mem ignore file.

> + * MAP_PRIVATE pages and MAP_SHARED reservations.
> + *
> + * Commit a1e78772d72b introduced MAP_PRIVATE reservations at mmap() time,
> + * so quota is checked upfront and mmap() fails with ENOMEM when over quota.
> + * Before this, quota was only checked at fault time resulting in SIGBUS.

Could these exported documentation identifiers use reStructuredText
formatting? MAP_PRIVATE, MAP_SHARED, ENOMEM, and SIGBUS should be enclosed in
double backticks, and mmap should be written as :manpage:`mmap(2)`.

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

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [LTP] hugetlb/hugemmap: add hugemmap33 to test hugetlbfs quota accounting
  2026-08-31  4:19 [LTP] [PATCH v5] " Pavithra
@ 2026-08-31  9:12 ` linuxtestproject.agent
  0 siblings, 0 replies; 11+ messages in thread
From: linuxtestproject.agent @ 2026-08-31  9:12 UTC (permalink / raw)
  To: Pavithra; +Cc: ltp

Hi Pavithra,

On Aug 31, 2026, Pavithra wrote:
> hugetlb/hugemmap: add hugemmap33 to test hugetlbfs quota accounting

> 	for (b = a; b < a + size; b += hpage_size)
> 		*b = 1;
>
> 	tst_res(TINFO, "Testing unused quota cleanup for untouched mappings");
> 	run_quota_test(verify_quota_ok, hpage_size, MAP_PRIVATE);
> 	verify_quota_stat(1, 1, 1);

verify_quota_ok() faults and instantiates every page, so this does not test
cleanup of an untouched mapping. Use a map/unmap helper that does not access
the mapping before checking the quota counters.

> 	TESTPTR(mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0));
> 	c = TST_RET_PTR;
> 	if (c == MAP_FAILED) {
> 		if (TST_ERR == ENOMEM) {
> 			tst_res(TPASS | TERRNO, "COW mmap failed as expected due to quota");

No copy-on-write fault occurs because the second mapping is never accessed.
This retests private mmap reservation accounting; exercise a private write
that requires COW, or remove the COW claim.

> static void run_test(void)
> {
> 	tst_res(TINFO, "Testing unused quota cleanup for untouched mappings");
> 	run_quota_test(verify_quota_ok, hpage_size, MAP_PRIVATE);
> 	...
> 	run_quota_test(verify_quota_ok, hpage_size, MAP_PRIVATE);
> }
>
> static struct tst_test test = {
> 	...
> 	.test_all = run_test,

These multiple cases are manually dispatched through .test_all. Represent
them with a tcase array and use .test with .tcnt.

> +/hugetlb/hugemmap/hugemmap33

Test binaries must be ignored by a .gitignore in their own directory. Move
this entry to testcases/kernel/mem/hugetlb/hugemmap/.gitignore.

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

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [LTP] [PATCH v6] hugetlb/hugemmap: add hugemmap33 to test hugetlbfs quota accounting
@ 2026-09-02  7:51 Pavithra
  2026-09-02  8:28 ` [LTP] " linuxtestproject.agent
  0 siblings, 1 reply; 11+ messages in thread
From: Pavithra @ 2026-09-02  7:51 UTC (permalink / raw)
  To: ltp; +Cc: pavrampu

Test hugetlbfs quota accounting with filesystem size limits to check
for regressions in quota handling for MAP_PRIVATE and MAP_SHARED pages.

Signed-off-by: Pavithra <pavrampu@linux.ibm.com>
---
v5 -> v6:
- Add verify_quota_map_unmap() to test quota cleanup of untouched mappings
without faulting pages.
- Rename verify_quota_cow_fail() to verify_quota_private_resv_fail() as no
COW fault occurs; the test checks MAP_PRIVATE reservation exhaustion at
mmap() time.
- Replace .test_all with a tcase array using .test and .tcnt.
link to v5: https://lore.kernel.org/ltp/20260831041909.312922-1-pavrampu@linux.ibm.com/
---
 runtest/hugetlb                               |   1 +
 testcases/kernel/mem/.gitignore               |   1 +
 .../kernel/mem/hugetlb/hugemmap/hugemmap33.c  | 260 ++++++++++++++++++
 3 files changed, 262 insertions(+)
 create mode 100644 testcases/kernel/mem/hugetlb/hugemmap/hugemmap33.c

diff --git a/runtest/hugetlb b/runtest/hugetlb
index 621c9718a..e3ee42c2f 100644
--- a/runtest/hugetlb
+++ b/runtest/hugetlb
@@ -35,6 +35,7 @@ hugemmap29 hugemmap29
 hugemmap30 hugemmap30
 hugemmap31 hugemmap31
 hugemmap32 hugemmap32
+hugemmap33 hugemmap33
 hugemmap34 hugemmap34
 hugemmap35 hugemmap35
 hugemmap36 hugemmap36
diff --git a/testcases/kernel/mem/.gitignore b/testcases/kernel/mem/.gitignore
index 9e706e1c8..763f134dd 100644
--- a/testcases/kernel/mem/.gitignore
+++ b/testcases/kernel/mem/.gitignore
@@ -35,6 +35,7 @@
 /hugetlb/hugemmap/hugemmap30
 /hugetlb/hugemmap/hugemmap31
 /hugetlb/hugemmap/hugemmap32
+/hugetlb/hugemmap/hugemmap33
 /hugetlb/hugemmap/hugemmap34
 /hugetlb/hugemmap/hugemmap35
 /hugetlb/hugemmap/hugemmap36
diff --git a/testcases/kernel/mem/hugetlb/hugemmap/hugemmap33.c b/testcases/kernel/mem/hugetlb/hugemmap/hugemmap33.c
new file mode 100644
index 000000000..585ed588e
--- /dev/null
+++ b/testcases/kernel/mem/hugetlb/hugemmap/hugemmap33.c
@@ -0,0 +1,260 @@
+// SPDX-License-Identifier: LGPL-2.1-or-later
+/*
+ * Copyright (C) 2005-2007 David Gibson & Adam Litke, IBM Corporation.
+ * Copyright (c) Linux Test Project, 2024
+ * Copyright (C) 2025-2026 Naveed & Pavithra, IBM Corporation.
+ * Assisted with AI tools
+ */
+
+/*\
+ * Test hugetlbfs quota accounting with filesystem size limits.
+ *
+ * The number of global huge pages available to a mounted hugetlbfs filesystem
+ * can be limited using a quota mechanism by setting the size attribute at
+ * mount time. Older kernels did not properly handle quota accounting for
+ * MAP_PRIVATE pages and MAP_SHARED reservations.
+ *
+ * Commit a1e78772d72b introduced MAP_PRIVATE reservations at mmap() time,
+ * so quota is checked upfront and mmap() fails with ENOMEM when over quota.
+ * Before this, quota was only checked at fault time resulting in SIGBUS.
+ *
+ * Root is required to mount the quota-limited hugetlbfs instance.
+ */
+
+#define _GNU_SOURCE
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <sys/vfs.h>
+#include <sys/mount.h>
+#include "hugetlb.h"
+
+#define MNTPOINT "hugetlbfs/"
+
+static long hpage_size;
+static int quota_mounted;
+
+static void verify_quota_stat(long tot, long free, long avail)
+{
+	struct statfs s;
+
+	SAFE_STATFS(MNTPOINT, &s);
+
+	if ((long)s.f_blocks != tot || (long)s.f_bfree != free || (long)s.f_bavail != avail) {
+		tst_res(TFAIL, "Bad quota counters: total=%li free=%li avail=%li, expected %li %li %li",
+			(long)s.f_blocks, (long)s.f_bfree, (long)s.f_bavail,
+			tot, free, avail);
+		return;
+	}
+	tst_res(TPASS, "Quota counters are correct: total=%li free=%li avail=%li",
+		tot, free, avail);
+}
+
+static void verify_quota_map_unmap(unsigned long size, int mmap_flags)
+{
+	int fd;
+	char path[PATH_MAX];
+
+	snprintf(path, sizeof(path), "%s/test_file_%d", MNTPOINT, getpid());
+	fd = SAFE_OPEN(path, O_CREAT | O_RDWR, 0600);
+	SAFE_UNLINK(path);
+
+	TESTPTR(mmap(NULL, size, PROT_READ | PROT_WRITE, mmap_flags, fd, 0));
+	if (TST_RET_PTR == MAP_FAILED) {
+		tst_res(TFAIL | TERRNO, "mmap failed unexpectedly");
+		SAFE_CLOSE(fd);
+		return;
+	}
+
+	tst_res(TPASS, "Untouched mapping quota test passed as expected");
+	SAFE_CLOSE(fd);
+}
+
+static void verify_quota_ok(unsigned long size, int mmap_flags)
+{
+	int fd;
+	char *a, *b;
+	char path[PATH_MAX];
+
+	snprintf(path, sizeof(path), "%s/test_file_%d", MNTPOINT, getpid());
+	fd = SAFE_OPEN(path, O_CREAT | O_RDWR, 0600);
+	SAFE_UNLINK(path);
+
+	TESTPTR(mmap(NULL, size, PROT_READ | PROT_WRITE, mmap_flags, fd, 0));
+	a = TST_RET_PTR;
+	if (a == MAP_FAILED) {
+		tst_res(TFAIL | TERRNO, "mmap failed unexpectedly");
+		SAFE_CLOSE(fd);
+		return;
+	}
+
+	for (b = a; b < a + size; b += hpage_size)
+		*b = 1;
+
+	tst_res(TPASS, "Quota test passed as expected");
+	SAFE_MUNMAP(a, size);
+	SAFE_CLOSE(fd);
+}
+
+static void verify_quota_fail(unsigned long size, int mmap_flags)
+{
+	int fd;
+	char *a;
+	char path[PATH_MAX];
+
+	snprintf(path, sizeof(path), "%s/test_file_%d", MNTPOINT, getpid());
+	fd = SAFE_OPEN(path, O_CREAT | O_RDWR, 0600);
+	SAFE_UNLINK(path);
+
+	TESTPTR(mmap(NULL, size, PROT_READ | PROT_WRITE, mmap_flags, fd, 0));
+	a = TST_RET_PTR;
+	if (a == MAP_FAILED) {
+		if (TST_ERR == ENOMEM) {
+			tst_res(TPASS | TERRNO, "mmap failed as expected due to quota");
+			SAFE_CLOSE(fd);
+			return;
+		}
+		tst_res(TFAIL | TERRNO, "mmap failed unexpectedly");
+		SAFE_CLOSE(fd);
+		return;
+	}
+
+	tst_res(TFAIL, "mmap succeeded but quota exhaustion was expected");
+	SAFE_MUNMAP(a, size);
+	SAFE_CLOSE(fd);
+}
+
+static void verify_quota_private_resv_fail(unsigned long size, int mmap_flags)
+{
+	int fd;
+	char *a, *b, *c;
+	char path[PATH_MAX];
+
+	snprintf(path, sizeof(path), "%s/test_file_%d", MNTPOINT, getpid());
+	fd = SAFE_OPEN(path, O_CREAT | O_RDWR, 0600);
+	SAFE_UNLINK(path);
+
+	TESTPTR(mmap(NULL, size, PROT_READ | PROT_WRITE, mmap_flags, fd, 0));
+	a = TST_RET_PTR;
+	if (a == MAP_FAILED) {
+		tst_res(TFAIL | TERRNO, "mmap failed unexpectedly");
+		SAFE_CLOSE(fd);
+		return;
+	}
+
+	for (b = a; b < a + size; b += hpage_size)
+		*b = 1;
+
+	TESTPTR(mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0));
+	c = TST_RET_PTR;
+	if (c == MAP_FAILED) {
+		if (TST_ERR == ENOMEM) {
+			tst_res(TPASS | TERRNO,
+				"MAP_PRIVATE mmap failed as expected due to quota");
+			SAFE_MUNMAP(a, size);
+			SAFE_CLOSE(fd);
+			return;
+		}
+		tst_res(TFAIL | TERRNO, "MAP_PRIVATE mmap failed unexpectedly");
+		SAFE_MUNMAP(a, size);
+		SAFE_CLOSE(fd);
+		return;
+	}
+
+	tst_res(TFAIL, "MAP_PRIVATE mmap succeeded but quota exhaustion was expected");
+	SAFE_MUNMAP(c, size);
+	SAFE_MUNMAP(a, size);
+	SAFE_CLOSE(fd);
+}
+
+static struct tcase {
+	void (*fn)(unsigned long, int);
+	unsigned long size_mult;	/* multiplied by hpage_size at runtime */
+	int mmap_flags;
+	const char *desc;
+	int check_stat;			/* call verify_quota_stat(1,1,1) after */
+} tcases[] = {
+	{ verify_quota_map_unmap, 1, MAP_PRIVATE,
+	  "Unused quota cleanup for untouched MAP_PRIVATE mapping", 1 },
+	{ verify_quota_map_unmap, 1, MAP_SHARED,
+	  "Unused quota cleanup for untouched MAP_SHARED mapping", 1 },
+	{ verify_quota_ok, 1, MAP_PRIVATE,
+	  "Page instantiation within quota (MAP_PRIVATE)", 0 },
+	{ verify_quota_ok, 1, MAP_SHARED,
+	  "Page instantiation within quota (MAP_SHARED)", 0 },
+	{ verify_quota_fail, 2, MAP_SHARED,
+	  "Page instantiation over quota (MAP_SHARED)", 0 },
+	{ verify_quota_fail, 2, MAP_PRIVATE,
+	  "Private mapping quota check (MAP_PRIVATE)", 0 },
+	{ verify_quota_private_resv_fail, 1, MAP_SHARED,
+	  "Second MAP_PRIVATE reservation over quota (MAP_SHARED base)", 0 },
+	{ verify_quota_private_resv_fail, 1, MAP_PRIVATE,
+	  "Second MAP_PRIVATE reservation over quota (MAP_PRIVATE base)", 0 },
+	{ verify_quota_ok, 1, MAP_SHARED,
+	  "Operation within quota after failures (MAP_SHARED)", 0 },
+	{ verify_quota_ok, 1, MAP_PRIVATE,
+	  "Operation within quota after failures (MAP_PRIVATE)", 0 },
+};
+
+static void run_test(unsigned int i)
+{
+	const struct tcase *tc = &tcases[i];
+	pid_t pid;
+	int status;
+
+	tst_res(TINFO, "%s", tc->desc);
+
+	pid = SAFE_FORK();
+	if (pid == 0) {
+		tc->fn(tc->size_mult * hpage_size, tc->mmap_flags);
+		exit(0);
+	}
+
+	SAFE_WAITPID(pid, &status, 0);
+
+	if (WIFSIGNALED(status))
+		tst_res(TFAIL, "Child killed by signal %d", WTERMSIG(status));
+
+	if (tc->check_stat)
+		verify_quota_stat(1, 1, 1);
+}
+
+static void setup(void)
+{
+	char mount_opts[BUFSIZ];
+
+	hpage_size = tst_get_hugepage_size();
+
+	snprintf(mount_opts, sizeof(mount_opts), "size=%luK",
+		 hpage_size / 1024);
+
+	if (mount("none", MNTPOINT, "hugetlbfs", 0, mount_opts) == -1) {
+		if (errno == ENODEV)
+			tst_brk(TCONF, "hugetlbfs not supported");
+		tst_brk(TBROK | TERRNO, "mount() failed");
+	}
+	quota_mounted = 1;
+
+	tst_res(TINFO, "Mounted hugetlbfs with quota at %s (size=%luK)",
+		MNTPOINT, hpage_size / 1024);
+}
+
+static void cleanup(void)
+{
+	if (quota_mounted)
+		SAFE_UMOUNT(MNTPOINT);
+}
+
+static struct tst_test test = {
+	.tags = (struct tst_tag[]) {
+		{"linux-git", "a1e78772d72b"},
+		{}
+	},
+	.needs_root = 1,
+	.mntpoint = MNTPOINT,
+	.forks_child = 1,
+	.setup = setup,
+	.cleanup = cleanup,
+	.test = run_test,
+	.tcnt = ARRAY_SIZE(tcases),
+	.hugepages = {2, TST_NEEDS},
+};
-- 
2.55.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [LTP] hugetlb/hugemmap: add hugemmap33 to test hugetlbfs quota accounting
  2026-09-02  7:51 [LTP] [PATCH v6] hugetlb/hugemmap: add hugemmap33 to test hugetlbfs quota accounting Pavithra
@ 2026-09-02  8:28 ` linuxtestproject.agent
  0 siblings, 0 replies; 11+ messages in thread
From: linuxtestproject.agent @ 2026-09-02  8:28 UTC (permalink / raw)
  To: Pavithra; +Cc: ltp

Hi Pavithra,

On Wed, 2 Sep 2026, Pavithra wrote:
> hugetlb/hugemmap: add hugemmap33 to test hugetlbfs quota accounting

> static struct tcase {
> 	void (*fn)(unsigned long, int);

Both callback parameters need names. `make check-hugemmap33` reports
warnings here, so name them `size` and `mmap_flags`.

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

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [LTP] hugetlb/hugemmap: add hugemmap33 to test hugetlbfs quota accounting
  2026-09-05 12:45 [LTP] [PATCH v7] " Pavithra
@ 2026-09-05 15:58 ` linuxtestproject.agent
  0 siblings, 0 replies; 11+ messages in thread
From: linuxtestproject.agent @ 2026-09-05 15:58 UTC (permalink / raw)
  To: Pavithra; +Cc: ltp

Hi Pavithra,

On September 5, 2026, Pavithra wrote:
> hugetlb/hugemmap: add hugemmap33 to test hugetlbfs quota accounting

> +/hugetlb/hugemmap/hugemmap33

New test binaries must be ignored by a .gitignore in their own directory.
Move this entry to testcases/kernel/mem/hugetlb/hugemmap/.gitignore as
/hugemmap33.

> +	TESTPTR(mmap(NULL, size, PROT_READ | PROT_WRITE, mmap_flags, fd, 0));
> +	if (TST_RET_PTR == MAP_FAILED) {
> +		tst_res(TFAIL | TERRNO, "mmap failed unexpectedly");

Use TST_EXP_PASS_PTR_VOID() for expected successes and
TST_EXP_FAIL_PTR_VOID(..., ENOMEM) for expected failures instead of manually
combining TESTPTR(), errno checks, and tst_res(). Keep only the cleanup logic
that depends on TST_PASS or TST_RET_PTR.

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

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [LTP] hugetlb/hugemmap: add hugemmap33 to test hugetlbfs quota accounting
  2026-09-06 15:06 [LTP] [PATCH v8] " Pavithra
@ 2026-09-06 16:03 ` linuxtestproject.agent
  0 siblings, 0 replies; 11+ messages in thread
From: linuxtestproject.agent @ 2026-09-06 16:03 UTC (permalink / raw)
  To: Pavithra; +Cc: ltp

Hi Pavithra,

On 2026-09-06, Pavithra wrote:
> hugetlb/hugemmap: add hugemmap33 to test hugetlbfs quota accounting

> 	TST_EXP_FAIL_PTR_VOID(mmap(NULL, size, PROT_READ | PROT_WRITE, mmap_flags, fd, 0),
> 			       ENOMEM, "mmap over quota");
> 	if (!TST_PASS)
> 		SAFE_MUNMAP(TST_RET_PTR, size);

An unexpected errno also leaves TST_PASS false but TST_RET_PTR equal to
MAP_FAILED, so SAFE_MUNMAP() reports TBROK and obscures the original failure.
Only unmap a successful mapping; the same pattern below needs the same fix.

> 		{"linux-git", "a1e78772d72b"},

Use the full commit ID:
a1e78772d72b2616ed20e54896e68e0e7044854e.

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

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [LTP] hugetlb/hugemmap: add hugemmap33 to test hugetlbfs quota accounting
  2026-09-09  8:55 [LTP] [PATCH v9] " Pavithra
@ 2026-09-09 10:30 ` linuxtestproject.agent
  0 siblings, 0 replies; 11+ messages in thread
From: linuxtestproject.agent @ 2026-09-09 10:30 UTC (permalink / raw)
  To: Pavithra; +Cc: ltp

Hi Pavithra,

On Wed Sep 9 14:25:55 2026 +0530, Pavithra <pavrampu@linux.ibm.com> wrote:
> hugetlb/hugemmap: add hugemmap33 to test hugetlbfs quota accounting

> Test hugetlbfs quota accounting with filesystem size limits to check
> for regressions in quota handling for MAP_PRIVATE and MAP_SHARED pages.

The empty lines in the commit message body contain trailing whitespace,
which triggers checkpatch errors.

> +/*\
> + * Test hugetlbfs quota accounting with filesystem size limits.
> + *
> + * The number of global huge pages available to a mounted hugetlbfs filesystem
> + * can be limited using a quota mechanism by setting the size attribute at
> + * mount time. Older kernels did not properly handle quota accounting for
> + * MAP_PRIVATE pages and MAP_SHARED reservations.
> + *
> + * Commit a1e78772d72b introduced MAP_PRIVATE reservations at mmap() time,
> + * so quota is checked upfront and mmap() fails with ENOMEM when over quota.
> + * Before this, quota was only checked at fault time resulting in SIGBUS.
> + *
> + * Root is required to mount the quota-limited hugetlbfs instance.
> + */

Use :manpage:`mmap(2)` when referencing mmap() in the documentation block.

> +static void verify_quota_map_unmap(unsigned long size, int mmap_flags)
> +{
> +	int fd;
> +	char path[PATH_MAX];
> +
> +	snprintf(path, sizeof(path), "%s/test_file_%d", MNTPOINT, getpid());
> +	fd = SAFE_OPEN(path, O_CREAT | O_RDWR, 0600);
> +	SAFE_UNLINK(path);
> +
> +	TST_EXP_PASS_PTR_VOID(mmap(NULL, size, PROT_READ | PROT_WRITE, mmap_flags, fd, 0),
> +			       "mmap untouched mapping");
> +	SAFE_CLOSE(fd);
> +}

verify_quota_map_unmap() never unmaps the mapping. As a result, this
tests cleanup on process termination rather than unmapping an untouched
mapping. Call SAFE_MUNMAP(TST_RET_PTR, size) if TST_PASS before closing fd.

> +	snprintf(path, sizeof(path), "%s/test_file_%d", MNTPOINT, getpid());
> +	fd = SAFE_OPEN(path, O_CREAT | O_RDWR, 0600);
> +	SAFE_UNLINK(path);

Use tst_creat_unlinked(MNTPOINT, 0, 0600) instead of manually creating and
unlinking files across the test functions.

> +	if (mount("none", MNTPOINT, "hugetlbfs", 0, mount_opts) == -1) {
> +		if (errno == ENODEV)
> +			tst_brk(TCONF, "hugetlbfs not supported");
> +		tst_brk(TBROK | TERRNO, "mount() failed");
> +	}

Use SAFE_MOUNT("none", MNTPOINT, "hugetlbfs", 0, mount_opts). Hugepage
support is already checked by .hugepages before setup() runs.

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

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [LTP] hugetlb/hugemmap: add hugemmap33 to test hugetlbfs quota accounting
  2026-09-12  8:22 [LTP] [PATCH v10] " Pavithra
@ 2026-09-12 11:43 ` linuxtestproject.agent
  0 siblings, 0 replies; 11+ messages in thread
From: linuxtestproject.agent @ 2026-09-12 11:43 UTC (permalink / raw)
  To: Pavithra; +Cc: ltp

Hi Pavithra,

On Sat Sep 12 13:52:35 2026 +0530, Pavithra <pavrampu@linux.ibm.com> wrote:
> hugetlb/hugemmap: add hugemmap33 to test hugetlbfs quota accounting

Verdict - Reviewed

---
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

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2026-09-12 11:44 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-02  7:51 [LTP] [PATCH v6] hugetlb/hugemmap: add hugemmap33 to test hugetlbfs quota accounting Pavithra
2026-09-02  8:28 ` [LTP] " linuxtestproject.agent
  -- strict thread matches above, loose matches on Subject: below --
2026-09-12  8:22 [LTP] [PATCH v10] " Pavithra
2026-09-12 11:43 ` [LTP] " linuxtestproject.agent
2026-09-09  8:55 [LTP] [PATCH v9] " Pavithra
2026-09-09 10:30 ` [LTP] " linuxtestproject.agent
2026-09-06 15:06 [LTP] [PATCH v8] " Pavithra
2026-09-06 16:03 ` [LTP] " linuxtestproject.agent
2026-09-05 12:45 [LTP] [PATCH v7] " Pavithra
2026-09-05 15:58 ` [LTP] " linuxtestproject.agent
2026-08-31  4:19 [LTP] [PATCH v5] " Pavithra
2026-08-31  9:12 ` [LTP] " linuxtestproject.agent
2026-08-09 17:49 [LTP] [PATCH v4] " Pavithra
2026-08-09 18:42 ` [LTP] " linuxtestproject.agent
2026-08-09 16:22 [LTP] [PATCH v3] " Pavithra
2026-08-09 16:38 ` [LTP] " linuxtestproject.agent
2026-08-09 15:15 [LTP] [PATCH v3] " Pavithra
2026-08-09 15:34 ` [LTP] " linuxtestproject.agent
2026-07-17 16:02 [LTP] [PATCH] " Pavithra
2026-07-17 17:15 ` [LTP] " linuxtestproject.agent

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox