From: linuxtestproject.agent@gmail.com
To: Pavithra <pavrampu@linux.ibm.com>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] hugetlb/hugefallocate: Add hugefallocate03 to stress test fallocate on hugetlbfs
Date: Sat, 7 Nov 2026 10:51:45 +0000 [thread overview]
Message-ID: <20261107105145.4103-1-linuxtestproject.agent@gmail.com> (raw)
In-Reply-To: <20261107062811.79329-1-pavrampu@linux.ibm.com>
Hi Pavithra,
On Sat Nov 7, 2026, Pavithra <pavrampu@linux.ibm.com> wrote:
> hugetlb/hugefallocate: Add hugefallocate03 to stress test fallocate on hugetlbfs
> +#include <pthread.h>
> +#include <signal.h>
> +#include <setjmp.h>
> +#include <time.h>
> +
> +#include "hugetlb.h"
> +#include "lapi/fallocate.h"
> +#include "tst_safe_pthread.h"
testcases/kernel/mem/hugetlb/hugefallocate/Makefile is missing
"hugefallocate03: CFLAGS += -pthread" (or "LDLIBS += -lpthread"). On
supported distributions with glibc < 2.34, linking fails with undefined
references to pthread_create and pthread_join.
> + for (i = 0; i < FALLOCATE_ITERATIONS; i++) {
> + tpage = ((long long)random()) % (max_hpages);
> + err = fallocate(fd,
> + FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE,
> + tpage * hpage_size, hpage_size);
> + if (err) {
> + tst_res(TFAIL | TERRNO, "fallocate(PUNCH_HOLE) failed at page %ld", tpage);
> + return NULL;
> + }
> + err = fallocate(fd, 0, tpage * hpage_size, hpage_size);
> + if (err) {
> + tst_res(TFAIL | TERRNO, "fallocate(fill) failed at page %ld", tpage);
> + return NULL;
> + }
> + }
Each iteration punches and refills a hugepage, which zeroes a full hugepage in
the kernel (e.g. 200 GB total for 2 MB hugepages, or 1.6 TB for 16 MB
hugepages on ppc64le) and can exceed the default 30s timeout. Set .runtime in
struct tst_test and check tst_remaining_runtime() in the loop condition.
> + nr_hpages_free = SAFE_READ_MEMINFO(MEMINFO_HPAGE_FREE);
> + max_hpages = MIN(nr_hpages_free, MAX_PAGES_TO_USE);
> + free_before = nr_hpages_free;
> + rsvd_before = SAFE_READ_MEMINFO(MEMINFO_HPAGE_RSVD);
> +
> + /* First preallocate file with max_hpages pages */
> + err = fallocate(fd, 0, 0, hpage_size * max_hpages);
> + if (err) {
> + if (errno == EOPNOTSUPP)
> + tst_brk(TCONF, "fallocate() Operation is not supported");
> + tst_brk(TBROK | TERRNO, "fallocate() failed to preallocate");
> + }
Because .hugepages uses TST_REQUEST, tst_hugepages and nr_hpages_free can be 0
when the system cannot allocate hugepages. In that case max_hpages is 0 and
fallocate(fd, 0, 0, 0) fails with EINVAL, triggering TBROK instead of TCONF;
check "if (!tst_hugepages || !nr_hpages_free) tst_brk(TCONF, ...);" first.
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
next prev parent reply other threads:[~2026-11-07 10:52 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-07 6:28 [LTP] [PATCH v10] hugetlb/hugefallocate: Add hugefallocate03 to stress test fallocate on hugetlbfs Pavithra
2026-11-07 10:51 ` linuxtestproject.agent [this message]
-- strict thread matches above, loose matches on Subject: below --
2026-11-07 12:05 [LTP] [PATCH v11] " Pavithra
2026-11-07 16:44 ` [LTP] " linuxtestproject.agent
2026-09-23 8:01 [LTP] [PATCH v9] " Pavithra
2026-09-23 10:00 ` [LTP] " linuxtestproject.agent
2026-11-02 15:59 ` Cyril Hrubis
2026-09-20 11:35 [LTP] [PATCH v8] " Pavithra
2026-09-20 14:43 ` [LTP] " linuxtestproject.agent
2026-09-19 17:49 [LTP] [PATCH v7] " Pavithra
2026-09-19 20:14 ` [LTP] " linuxtestproject.agent
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261107105145.4103-1-linuxtestproject.agent@gmail.com \
--to=linuxtestproject.agent@gmail.com \
--cc=ltp@lists.linux.it \
--cc=pavrampu@linux.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.