|
|
Subscribe / Log in / New account

Collect memory utilization of a driver

Collect memory utilization of a driver

Posted Apr 11, 2025 7:42 UTC (Fri) by yanjun.zhu (guest, #173290)
Parent article: Preparing DAMON for future memory-management problems

Can we use this tool to get the memory utilization of a driver?
For example, when a driver is loaded with the command "modprobe xxx", can we know how much memory is allocated to load this driver?


to post comments

Collect memory utilization of a driver

Posted Apr 11, 2025 14:45 UTC (Fri) by sjpark (subscriber, #87716) [Link]

I think the answer is "no", unfortunately. DAMON is for access monitoring rather than memory utilization. Also, it works for only user space memory for now. Memory allocation profiling (https://docs.kernel.org/mm/allocation-profiling.html) might help you?

Collect memory utilization of a driver

Posted Apr 14, 2025 8:31 UTC (Mon) by taladar (subscriber, #68407) [Link] (3 responses)

Shouldn't that just be the code size of that module?

Isn't the actually interesting bit how much the driver allocates for data over its lifetime that wouldn't be allocated if the driver was not in use?

Collect memory utilization of a driver

Posted Apr 14, 2025 8:36 UTC (Mon) by yanjun.zhu (guest, #173290) [Link] (2 responses)

Not at all. Actually, I am interested in how much memory will be used when a driver is loaded into kernel. You know sometimes a lot of memory will be allocated at initialization phase when a driver is loaded into kernel.
I wonder if there is a method to check how much memory will be used when a driver is loaded into kernel directly and conviently.

Collect memory utilization of a driver

Posted Apr 14, 2025 8:48 UTC (Mon) by adobriyan (subscriber, #30858) [Link] (1 responses)

There is no such method. You load the driver and recalculate slab/vmalloc/percpu stats.

Collect memory utilization of a driver

Posted Apr 14, 2025 9:12 UTC (Mon) by yanjun.zhu (guest, #173290) [Link]

Exactly. It is the only way that we can do currently.


Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds