Linux Trace Kernel
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Qiliang Yuan" <odys.yuan@gmail.com>
Cc: linux-trace-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] mm/compaction: keep compaction deferral state per migration mode
Date: Thu, 01 Oct 2026 15:42:15 +0000	[thread overview]
Message-ID: <20261001154216.59C1A1F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20261001-bug-mm-thp-async-compact-defer-v1-1-0174c7923430@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] mm: incomplete tracing of async mode in compaction_defer_reset()
--

commit 0627b5eaa00c60d552c24b2f41326741ce401351
Author: Qiliang Yuan <odys.yuan@gmail.com>

mm/compaction: keep compaction deferral state per migration mode

This commit updates compaction deferral state variables to be arrays
indexed by the sync migration mode. The deferral tracepoints are also
updated to include a sync field to indicate which state they report.

> diff --git a/mm/compaction.c b/mm/compaction.c
> index a049415512c67..7f8845d1990aa 100644
> --- a/mm/compaction.c
> +++ b/mm/compaction.c

[ ... ]

> @@ -165,24 +165,28 @@ static bool compaction_deferred(struct zone *zone, int order)
>  void compaction_defer_reset(struct zone *zone, int order,
>  		bool alloc_success)
>  {
> -	if (alloc_success) {
> -		zone->compact_considered = 0;
> -		zone->compact_defer_shift = 0;
> +	int sync;
> +
> +	for (sync = 0; sync < ASYNC_AND_SYNC; sync++) {
> +		if (alloc_success) {
> +			zone->compact_considered[sync] = 0;
> +			zone->compact_defer_shift[sync] = 0;
> +		}
> +		if (order >= zone->compact_order_failed[sync])
> +			zone->compact_order_failed[sync] = order + 1;
>  	}
> -	if (order >= zone->compact_order_failed)
> -		zone->compact_order_failed = order + 1;
>  
> -	trace_mm_compaction_defer_reset(zone, order);
> +	trace_mm_compaction_defer_reset(zone, order, true);

[Severity: Medium]
Does this miss tracing the async state reset?

The code in compaction_defer_reset() updates both the async and sync state
arrays within the loop, but the trace event is emitted outside the loop with a
hardcoded true argument for the sync parameter.

This seems to silently omit the state transition for async compaction where
sync is false. Userspace tracing tools might miss the deferral reset event
for async compaction and falsely assume it remains deferred after a reset.

Should this trace event be moved inside the loop to emit for both states, or
is there a reason to only trace the sync reset?

>  }

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261001-bug-mm-thp-async-compact-defer-v1-0-0174c7923430@gmail.com?part=1

  reply	other threads:[~2026-10-01 15:42 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-01 15:33 [PATCH 0/2] mm/compaction: stop repeating failed async compaction on every THP fault Qiliang Yuan
2026-10-01 15:33 ` [PATCH 1/2] mm/compaction: keep compaction deferral state per migration mode Qiliang Yuan
2026-10-01 15:42   ` sashiko-bot [this message]
2026-10-01 15:33 ` [PATCH 2/2] mm/compaction: defer failed async direct compaction Qiliang Yuan
2026-10-01 15:46   ` sashiko-bot
2026-10-02 14:21 ` [PATCH 0/2] mm/compaction: stop repeating failed async compaction on every THP fault Lorenzo Stoakes (ARM)
2026-10-02 16:17   ` Qiliang Yuan
2026-10-02 17:00     ` Liam R. Howlett

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=20261001154216.59C1A1F000FF@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=odys.yuan@gmail.com \
    --cc=sashiko-reviews@lists.linux.dev \
    /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