kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
* stap shows kfree() is 5 times more than kallocs, how could be?
@ 2018-10-15 12:17 Lev Olshvang
  2018-10-15 12:30 ` Bernd Petrovitsch
  0 siblings, 1 reply; 2+ messages in thread
From: Lev Olshvang @ 2018-10-15 12:17 UTC (permalink / raw)
  To: kernelnewbies

Hello all,

I am debugging kernel module and use  SystemTap to monitor requested and freed memory.

I see that SystemTap statistics shows that kfree() is called 5 times more than kalloc. 
It happens not only on my module, it happens on VirtualBox vboxsf driver as well.

See hits count below  kmalloc hits: 21561
                                  kfree      hits: 102175


----- probe hit report:
kernel.function("__kmalloc at mm/slub.c:3706"), (./kmalloc_argus.stp:10:1), hits: 21561, cycles: 21228min/52226avg/334688max, from: kernel.function("__kmalloc at mm/slub.c:3706") from: kernel.function("__kmalloc"), index: 0
kernel.function("__kmalloc at mm/slub.c:3706").return, (./kmalloc_argus.stp:25:1), hits: 21561, cycles: 18843min/51228avg/406816max, from: kernel.function("__kmalloc at mm/slub.c:3706").return from: kernel.function("__kmalloc").return, index: 1
kernel.function("kfree at mm/slub.c:3843"), (./kmalloc_argus.stp:38:1), hits: 102175, cycles: 400min/1557avg/499754max, from: kernel.function("kfree at mm/slub.c:3843") from: kernel.function("kfree"), index: 2


Please comment.

Lev

^ permalink raw reply	[flat|nested] 2+ messages in thread

* stap shows kfree() is 5 times more than kallocs, how could be?
  2018-10-15 12:17 stap shows kfree() is 5 times more than kallocs, how could be? Lev Olshvang
@ 2018-10-15 12:30 ` Bernd Petrovitsch
  0 siblings, 0 replies; 2+ messages in thread
From: Bernd Petrovitsch @ 2018-10-15 12:30 UTC (permalink / raw)
  To: kernelnewbies

Hi all!

On 15/10/18 14:17, Lev Olshvang wrote:
[...]
> I am debugging kernel module and use  SystemTap to monitor requested and freed memory.
> 
> I see that SystemTap statistics shows that kfree() is called 5 times more than kalloc. 
> It happens not only on my module, it happens on VirtualBox vboxsf driver as well.
> 
> See hits count below  kmalloc hits: 21561
>                                   kfree      hits: 102175

"kfree(NULL)" is a legal NO-OP (and basically all other similar
functions are expected to gracefully accept a NULL pointer).

MfG,
	Bernd
-- 
"I dislike type abstraction if it has no real reason. And saving
on typing is not a good reason - if your typing speed is the main
issue when you're coding, you're doing something seriously wrong."
    - Linus Torvalds
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pEpkey.asc
Type: application/pgp-keys
Size: 2472 bytes
Desc: not available
URL: <http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20181015/68cdcf8a/attachment.bin>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-10-15 12:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-15 12:17 stap shows kfree() is 5 times more than kallocs, how could be? Lev Olshvang
2018-10-15 12:30 ` Bernd Petrovitsch

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).