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: <a0ebf2e.b422.196abf97373.Coremail.00107082@163.com>
Date: Thu, 8 May 2025 02:19:34 +0800 (CST)
From: "David Wang" <00107082@....com>
To: surenb@...gle.com, kent.overstreet@...ux.dev, akpm@...ux-foundation.org
Cc: linux-mm@...ck.org, linux-kernel@...r.kernel.org
Subject: Re:[PATCH] alloc_tag: avoid mem alloc and iter reset when reading
 allocinfo

Hi, 
Just want to share how I notice those memory allocation behaivors: the cumulative counters~!

With cumulative counters, I can identify which module keeps alloc/free memory, by the ratio between
 cumulative calls and remaining calls, and maybe an optimization could be applied.
Following is top16 I got on my system:

+-----------------------------------------+-------+------------------+--------------------+
|                  alloc                  | calls | cumulative calls |       ratio        |
+-----------------------------------------+-------+------------------+--------------------+
|            fs/seq_file.c:584            |   2   |     18064825     |     9032412.5      |
|             fs/seq_file.c:38            |   5   |     18148288     |     3629657.6      |
|             fs/seq_file.c:63            |   15  |     18153271     | 1210218.0666666667 |
|          net/core/skbuff.c:577          |   9   |     10679975     | 1186663.888888889  |
|          net/core/skbuff.c:658          |   21  |     11013437     |  524449.380952381  |
|             fs/select.c:168             |   7   |     2831226      | 404460.85714285716 |
|            lib/alloc_tag.c:51           |   1   |      340649      |      340649.0      |  <--- Here I started
|           kernel/signal.c:455           |   1   |      300730      |      300730.0      |
| fs/notify/inotify/inotify_fsnotify.c:96 |   1   |      249831      |      249831.0      |
|            fs/ext4/dir.c:675            |   3   |      519734      | 173244.66666666666 |
|       drivers/usb/host/xhci.c:1555      |   4   |      126402      |      31600.5       |
|              fs/locks.c:275             |   36  |      986957      | 27415.472222222223 |
|           fs/proc/inode.c:502           |   3   |      63753       |      21251.0       |
|              fs/pipe.c:125              |  123  |     2143378      | 17425.837398373984 |
|            net/core/scm.c:84            |   3   |      43267       | 14422.333333333334 |
|         fs/kernel_read_file.c:80        |   2   |      26910       |      13455.0       |
+-----------------------------------------+-------+------------------+--------------------+

I think this is another "good" usage for cumulative counters: if a module just keeps alloc/free memory,
maybe it is good to move the memory alloc/free to somewhere less frequent.

In the case of this patch, a memory allocation for each read-calls, can be moved to opan-calls.

If interested, I can re-send the patch for cumulative counters for further discussions.


FYI
David

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ