diff options
Diffstat (limited to 'tools/vm')
-rw-r--r-- | tools/vm/page-types.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/tools/vm/page-types.c b/tools/vm/page-types.c index dab61c377f54..e92903fc7113 100644 --- a/tools/vm/page-types.c +++ b/tools/vm/page-types.c @@ -633,7 +633,15 @@ static void walk_pfn(unsigned long voffset, unsigned long pages; unsigned long i; - memset(cgi, 0, sizeof cgi); + /* + * kpagecgroup_read() reads only if kpagecgroup were opened, but + * /proc/kpagecgroup might even not exist, so it's better to fill + * them with zeros here. + */ + if (count == 1) + cgi[0] = 0; + else + memset(cgi, 0, sizeof cgi); while (count) { batch = min_t(unsigned long, count, KPAGEFLAGS_BATCH); |