Skip to content

Instantly share code, notes, and snippets.

@tlhakhan
Created July 26, 2021 14:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tlhakhan/459fc0ceb99dd92a83f13e1a03e29420 to your computer and use it in GitHub Desktop.
Save tlhakhan/459fc0ceb99dd92a83f13e1a03e29420 to your computer and use it in GitHub Desktop.
root@batfs0557:~# cat super_cache_scan.bt
#!/bin/env /usr/bin/bpftrace
#include <linux/types.h>
#include <asm-generic/atomic-long.h>
#include <linux/shrinker.h>
kprobe:super_cache_scan {
$sc = (struct shrink_control *) arg1;
@nr_to_scan[$sc->nid, comm, probe] = hist($sc->nr_to_scan);
}
kretprobe:super_cache_scan {
@freed[comm, probe] = hist(retval);
}
root@batfs0557:~# ./super_cache_scan.bt
Attaching 2 probes...
^C
@freed[arc_prune, kretprobe:super_cache_scan]:
[0] 261849 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@|
[1] 35580 |@@@@@@@ |
[2, 4) 90 | |
[4, 8) 53 | |
[8, 16) 68 | |
[16, 32) 143 | |
[32, 64) 109 | |
[64, 128) 10 | |
[128, 256) 9 | |
[256, 512) 24 | |
[512, 1K) 59 | |
[1K, 2K) 109 | |
[2K, 4K) 45 | |
@nr_to_scan[0, arc_prune, kprobe:super_cache_scan]:
[8K, 16K) 258 | |
[16K, 32K) 432 | |
[32K, 64K) 419 | |
[64K, 128K) 716 | |
[128K, 256K) 1430 |@ |
[256K, 512K) 3302 |@@@ |
[512K, 1M) 6532 |@@@@@ |
[1M, 2M) 13987 |@@@@@@@@@@@@ |
[2M, 4M) 19292 |@@@@@@@@@@@@@@@@@ |
[4M, 8M) 32063 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ |
[8M, 16M) 57007 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@|
[16M, 32M) 13612 |@@@@@@@@@@@@ |
@nr_to_scan[1, arc_prune, kprobe:super_cache_scan]:
[0] 4 | |
[1] 148181 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@|
[2, 4) 0 | |
[4, 8) 0 | |
[8, 16) 0 | |
[16, 32) 0 | |
[32, 64) 0 | |
[64, 128) 0 | |
[128, 256) 0 | |
[256, 512) 0 | |
[512, 1K) 0 | |
[1K, 2K) 0 | |
[2K, 4K) 0 | |
[4K, 8K) 0 | |
[8K, 16K) 6 | |
[16K, 32K) 4 | |
[32K, 64K) 3 | |
[64K, 128K) 4 | |
[128K, 256K) 5 | |
[256K, 512K) 4 | |
[512K, 1M) 4 | |
[1M, 2M) 19 | |
[2M, 4M) 76 | |
[4M, 8M) 440 | |
[8M, 16M) 277 | |
[16M, 32M) 23 | |
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment