lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20260123150108.43443-1-wujianyue000@gmail.com>
Date: Fri, 23 Jan 2026 23:01:07 +0800
From: Jianyue Wu <wujianyue000@...il.com>
To: akpm@...ux-foundation.org
Cc: shakeel.butt@...ux.dev,
	hannes@...xchg.org,
	mhocko@...nel.org,
	roman.gushchin@...ux.dev,
	muchun.song@...ux.dev,
	linux-mm@...ck.org,
	cgroups@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	inwardvessel@...il.com,
	Jianyue Wu <wujianyue000@...il.com>
Subject: [PATCH v4 0/1] mm: memcg: optimize stat output to reduce printf overhead

This patch optimizes memcg stat output by replacing seq_buf_printf() with
a lightweight helper and replacing seq_printf() in numa stat functions with
direct seq operations.

Changes in v4:
- Embed separator and newline in buffer to reduce function calls in
  memcg_seq_buf_print_stat() (suggested by JP Kobryn)
- Optimize memory_numa_stat_show() and memcg_numa_stat_show() by replacing
  seq_printf() with seq_puts() and seq_put_decimal_ull()
- Add comments explaining the optimization approach
- Note: Did not add a separate API for the numa stat case because the output
  format "N0=value0 N1=value1" is too specific - the "N" prefix and node ID
  are separate values that don't fit a name=value pattern. Using
  seq_put_decimal_ull() directly is more flexible and clear.

Changes in v3:
- Rebased to latest mm-unstable
- Updated commit message to clarify the optimization approach

Changes in v2:
- Initial version with seq_buf optimization

Performance improvement (1M reads of memory.stat + memory.numa_stat):
- Before: real 0m9.663s, user 0m4.840s, sys 0m4.823s
- After:  real 0m8.909s, user 0m4.661s, sys 0m4.247s
- Result: ~11% sys time reduction

Jianyue Wu (1):
  mm: optimize stat output for 11% sys time reduce

 mm/memcontrol-v1.c | 84 ++++++++++++++++++++++++-------------------
 mm/memcontrol-v1.h |  4 +++
 mm/memcontrol.c    | 88 +++++++++++++++++++++++++++++++++++++---------
 3 files changed, 123 insertions(+), 53 deletions(-)

-- 
2.43.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ