From: Johannes Weiner <hannes@cmpxchg.org>
To: Jianyue Wu <wujianyue000@gmail.com>
Cc: akpm@linux-foundation.org, shakeel.butt@linux.dev,
mhocko@kernel.org, roman.gushchin@linux.dev,
muchun.song@linux.dev, linux-mm@kvack.org,
cgroups@vger.kernel.org, linux-kernel@vger.kernel.org,
inwardvessel@gmail.com
Subject: Re: [PATCH v4 1/1] mm: optimize stat output for 11% sys time reduce
Date: Mon, 2 Mar 2026 14:43:11 -0500 [thread overview]
Message-ID: <aaXoT17JoTv87l40@cmpxchg.org> (raw)
In-Reply-To: <20260123150108.43443-2-wujianyue000@gmail.com>
On Fri, Jan 23, 2026 at 11:01:08PM +0800, Jianyue Wu wrote:
> +void memcg_seq_buf_print_stat(struct seq_buf *s, const char *prefix,
> + const char *name, char sep, u64 val)
> +{
> + char num_buf[MEMCG_DEC_U64_MAX_LEN + 2]; /* +2 for separator and newline */
> + int num_len;
> +
> + /* Embed separator at the beginning */
> + num_buf[0] = sep;
> +
> + /* Convert number starting at offset 1 */
> + num_len = num_to_str(num_buf + 1, sizeof(num_buf) - 2, val, 0);
> + if (num_len <= 0)
> + return;
> +
> + /* Embed newline at the end */
> + num_buf[num_len + 1] = '\n';
> +
> + if (prefix && *prefix && seq_buf_puts(s, prefix))
> + return;
> + if (seq_buf_puts(s, name))
> + return;
> + /* Output separator, value, and newline in one call */
> + seq_buf_putmem(s, num_buf, num_len + 2);
You seem to be losing the \0 somewhere. I'm getting garbage at the end
of memory.stat on mm-new:
[...]
thp_swpout_fallback 1212
hp_swpout_fallback 1212
hp_swpout_fallback 1054
907
1278
Dropping this patch fixes the issue.
prev parent reply other threads:[~2026-03-02 19:43 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-08 9:37 [PATCH] " Jianyue Wu
2026-01-08 19:10 ` Andrew Morton
2026-01-08 22:49 ` Roman Gushchin
2026-01-08 23:52 ` Jiany Wu
2026-01-08 23:56 ` Jiany Wu
2026-01-10 4:22 ` [PATCH v2] " Jianyue Wu
2026-01-10 23:33 ` Andrew Morton
2026-01-11 4:37 ` Jianyue Wu
2026-01-13 0:23 ` Shakeel Butt
2026-01-13 0:29 ` Shakeel Butt
2026-01-22 11:42 ` [PATCH v3] " Jianyue Wu
2026-01-22 17:13 ` Andrew Morton
2026-01-22 21:12 ` Shakeel Butt
2026-01-23 1:07 ` Jianyue Wu
2026-01-23 8:14 ` JP Kobryn
2026-01-23 13:24 ` Jianyue Wu
2026-01-23 15:01 ` [PATCH v4 0/1] mm: memcg: optimize stat output to reduce printf overhead Jianyue Wu
2026-01-23 15:01 ` [PATCH v4 1/1] mm: optimize stat output for 11% sys time reduce Jianyue Wu
2026-01-23 15:06 ` Jianyue Wu
2026-03-02 19:43 ` Johannes Weiner [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=aaXoT17JoTv87l40@cmpxchg.org \
--to=hannes@cmpxchg.org \
--cc=akpm@linux-foundation.org \
--cc=cgroups@vger.kernel.org \
--cc=inwardvessel@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@kernel.org \
--cc=muchun.song@linux.dev \
--cc=roman.gushchin@linux.dev \
--cc=shakeel.butt@linux.dev \
--cc=wujianyue000@gmail.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