Re: [patch 014/173] mm, tracing: record slab name for kmem_cache_free()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 26 Feb 2021 11:48:18 +0800
Jacob Wen <jian.w.wen@xxxxxxxxxx> wrote:

> Removing a kernel module to see if it releases a lot of memory is
> helpful to quickly find out the root causes of some issues.
> 
> It seems nice to reserve the symbols. I don't have a relevant use case
> so it's just my 2 cents.

It's much more complex than that. We do something similar, where we keep
the kallsyms for the module init code (otherwise when tracing a module that
is loaded, you wont be able to see its functions).

But the complexity comes from the fact that kallsyms has addresses
associated to functions that no longer exist. Now what happens when new
code maps at those addresses? It confuses kallsyms.

Yeah, unloading of a module will turn function names into their original
address, and worse, can even show function names for new code added. But
there's not much we can do without having to save all kallsyms that were
ever loaded, along with time stamps to know when they were valid. And
remember, this is all in kernel memory that is never swapped out.

If you want to add a feature to do something like that go ahead. I would
recommend a "time out" where after a given time (user defined) that older
symbols are flushed from the system, and perhaps even allow the user to
define the number of symbols to keep around after they are gone. At least
this will let the users decide how much memory they want to waste for this.

-- Steve



[Index of Archives]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux