You've already forked linux-rockchip
mirror of
https://github.com/armbian/linux-rockchip.git
synced 2026-01-06 11:08:10 -08:00
UPSTREAM: tools/vm/slabinfo: Handle files in debugfs
Commit64dd68497brelocated and renamed the alloc_calls and free_calls files from /sys/kernel/slab/NAME/*_calls over to /sys/kernel/debug/slab/NAME/*_calls but didn't update the slabinfo tool with the new location. This change will now have slabinfo look at the new location (and filenames) with a fallback to the prior files. Bug: 254441685 Fixes:64dd68497b("mm: slub: move sysfs slab alloc/free interfaces to debugfs") Cc: stable@vger.kernel.org Signed-off-by: Stéphane Graber <stgraber@ubuntu.com> Tested-by: Stéphane Graber <stgraber@ubuntu.com> Signed-off-by: Vlastimil Babka <vbabka@suse.cz> (cherry picked from commit0c7e0d699e) Signed-off-by: Lee Jones <joneslee@google.com> Change-Id: I7312aa9e86213bd37916e14c8e0e430e9c3cd2d4
This commit is contained in:
committed by
Treehugger Robot
parent
0b21c99c83
commit
c3b65245e6
@@ -233,6 +233,24 @@ static unsigned long read_slab_obj(struct slabinfo *s, const char *name)
|
||||
return l;
|
||||
}
|
||||
|
||||
static unsigned long read_debug_slab_obj(struct slabinfo *s, const char *name)
|
||||
{
|
||||
char x[128];
|
||||
FILE *f;
|
||||
size_t l;
|
||||
|
||||
snprintf(x, 128, "/sys/kernel/debug/slab/%s/%s", s->name, name);
|
||||
f = fopen(x, "r");
|
||||
if (!f) {
|
||||
buffer[0] = 0;
|
||||
l = 0;
|
||||
} else {
|
||||
l = fread(buffer, 1, sizeof(buffer), f);
|
||||
buffer[l] = 0;
|
||||
fclose(f);
|
||||
}
|
||||
return l;
|
||||
}
|
||||
|
||||
/*
|
||||
* Put a size string together
|
||||
@@ -409,14 +427,18 @@ static void show_tracking(struct slabinfo *s)
|
||||
{
|
||||
printf("\n%s: Kernel object allocation\n", s->name);
|
||||
printf("-----------------------------------------------------------------------\n");
|
||||
if (read_slab_obj(s, "alloc_calls"))
|
||||
if (read_debug_slab_obj(s, "alloc_traces"))
|
||||
printf("%s", buffer);
|
||||
else if (read_slab_obj(s, "alloc_calls"))
|
||||
printf("%s", buffer);
|
||||
else
|
||||
printf("No Data\n");
|
||||
|
||||
printf("\n%s: Kernel object freeing\n", s->name);
|
||||
printf("------------------------------------------------------------------------\n");
|
||||
if (read_slab_obj(s, "free_calls"))
|
||||
if (read_debug_slab_obj(s, "free_traces"))
|
||||
printf("%s", buffer);
|
||||
else if (read_slab_obj(s, "free_calls"))
|
||||
printf("%s", buffer);
|
||||
else
|
||||
printf("No Data\n");
|
||||
|
||||
Reference in New Issue
Block a user