From: "Vlastimil Babka (SUSE)" <vbabka@kernel.org>
To: Zhu Jun <zhujun2@cmss.chinamobile.com>
Cc: hannes@cmpxchg.org, surenb@google.com, mhocko@suse.com,
brendan.jackman@linux.dev, ziy@nvidia.com,
akpm@linux-foundation.org, david@kernel.org, ljs@kernel.org,
liam@infradead.org, rppt@kernel.org, iamjoonsoo.kim@lge.com,
linux-mm@kvack.org
Subject: Re: [PATCH] tools/mm: Report page_owner_sort output errors
Date: Mon, 23 Nov 2026 12:10:20 +0100 [thread overview]
Message-ID: <b161e961-eef4-408d-944c-eb352d3088fb@kernel.org> (raw)
In-Reply-To: <20261120062146.98518-1-zhujun2@cmss.chinamobile.com>
On 11/20/26 07:21, Zhu Jun wrote:
> page_owner_sort does not check its output stream for errors and relies
> on process exit to flush buffered data. For example, writing a small
> result to /dev/full returns success even though no output is saved.
>
> Check for earlier stream errors and explicitly close the output before
> reporting success, so errors flushing the final buffer also produce a
> failing exit status.
>
> Fixes: 48c96a368579 ("mm/page_owner: keep track of page owners")
> Signed-off-by: Zhu Jun <zhujun2@cmss.chinamobile.com>
Applied to page_alloc/for-next, thanks!
> ---
> tools/mm/page_owner_sort.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/tools/mm/page_owner_sort.c b/tools/mm/page_owner_sort.c
> index 48c403d3de4f..13166199ef0d 100644
> --- a/tools/mm/page_owner_sort.c
> +++ b/tools/mm/page_owner_sort.c
> @@ -1024,6 +1024,11 @@ int main(int argc, char **argv)
> }
> }
>
> + if (ferror(fout) || fclose(fout)) {
> + perror("write output");
> + exit(1);
> + }
> +
> out_free:
> if (ext_buf)
> free(ext_buf);
>
>
prev parent reply other threads:[~2026-11-23 11:10 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-20 6:21 [PATCH] tools/mm: Report page_owner_sort output errors Zhu Jun
2026-11-23 11:10 ` Vlastimil Babka (SUSE) [this message]
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=b161e961-eef4-408d-944c-eb352d3088fb@kernel.org \
--to=vbabka@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=brendan.jackman@linux.dev \
--cc=david@kernel.org \
--cc=hannes@cmpxchg.org \
--cc=iamjoonsoo.kim@lge.com \
--cc=liam@infradead.org \
--cc=linux-mm@kvack.org \
--cc=ljs@kernel.org \
--cc=mhocko@suse.com \
--cc=rppt@kernel.org \
--cc=surenb@google.com \
--cc=zhujun2@cmss.chinamobile.com \
--cc=ziy@nvidia.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