Linux Test Project
 help / color / mirror / Atom feed
From: linuxtestproject.agent@gmail.com
To: Pavithra <pavrampu@linux.ibm.com>
Cc: ltp@lists.linux.it, LTP AI Reviewer <ltp-ai@noreply.github.com>
Subject: Re: [LTP] memcg/memcontrol04: Fix race in pagecache allocation measurement
Date: Mon, 25 May 2026 17:12:03 +0000	[thread overview]
Message-ID: <20260525171203.3996-1-linuxtestproject.agent@gmail.com> (raw)
In-Reply-To: <20260525153352.188816-1-pavrampu@linux.ibm.com>

Hi Pavithra,

On Mon, 25 May 2026, Pavithra wrote:
> memcg/memcontrol04: Fix race in pagecache allocation measurement

> +static unsigned int num_children_spawned;

> +enum checkpoints {
> -	CHILD_IDLE
> +	CHILD_IDLE,
> +	TEST_DONE,
>  };

> +	if (num_children_spawned > 0) {
> +		TST_CHECKPOINT_WAKE2(TEST_DONE, num_children_spawned);
> +		tst_reap_children();
> +		num_children_spawned = 0;
> +	}

Correct. Waking all pagecache children before tst_reap_children() and
resetting the counter is safe since cleanup_sub_groups() is idempotent
(called both from test_memcg_low() and cleanup()).

> -		tst_reap_children();
> +		SAFE_WAITPID(pid, NULL, 0);

Good catch. The old tst_reap_children() would have reaped the still-
waiting pagecache children prematurely.

> +	num_children_spawned++;
> +	TST_CHECKPOINT_WAIT(CHILD_IDLE);

Sequential fork+wait pairs mean CHILD_IDLE is always at zero before
the next child is forked, so there's no ambiguity in who signals it.

> +	SAFE_FSYNC(fd);
> +
> +	TST_CHECKPOINT_WAKE(CHILD_IDLE);
> +	TST_CHECKPOINT_WAIT(TEST_DONE);

fsync before signalling the parent ensures the pagecache is durably
accounted before memory.current is read.

> +	num_children_spawned = 0;
>  	fd = SAFE_OPEN(TMPDIR"/tmpfile", O_RDWR | O_CREAT, 0600);

Explicit reset at the start of each test_all invocation is the right
place; handles repeated runs correctly.

Reviewed-by: LTP AI Reviewer <ltp-ai@noreply.github.com>

---
Note:

Our agent completed the review of the patch. The full review can be
found at: https://github.com/linux-test-project/ltp-agent/actions/runs/26411599009

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

  reply	other threads:[~2026-05-25 17:12 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-25 15:33 [LTP] [PATCH] [PATCH V2] memcg/memcontrol04: Fix race in pagecache allocation measurement Pavithra
2026-05-25 17:12 ` linuxtestproject.agent [this message]
2026-06-09  8:34 ` [LTP] " linuxtestproject.agent
2026-06-09  8:34 ` linuxtestproject.agent
2026-06-12  9:35 ` [LTP] [PATCH] [PATCH V2] " Andrea Cervesato via ltp

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=20260525171203.3996-1-linuxtestproject.agent@gmail.com \
    --to=linuxtestproject.agent@gmail.com \
    --cc=ltp-ai@noreply.github.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox