----- "Per Fransson" <per.xx.fransson(a)stericsson.com> wrote:
Hi Dave,
"kmem -i" aborts before it completes when swapping isn't enabled. This
is a suggestion for fixing it.
Regards,
Per
Looks safe enough -- re-formatted and queued for the next release.
Thanks,
Dave
diff --git a/memory.c b/memory.c
index 287285f..cb02c57 100755
--- a/memory.c
+++ b/memory.c
@@ -6717,7 +6717,7 @@ dump_kmeminfo(void)
} else if (dump_vm_stat("NR_FILE_PAGES", &nr_file_pages, 0)) {
char *swapper_space = GETBUF(SIZE(address_space));
- if (!readmem(symbol_value("swapper_space"), KVADDR,
swapper_space,
+ if (!symbol_exists("swapper_space") ||
!readmem(symbol_value("swapper_space"), KVADDR, swapper_space,
SIZE(address_space), "swapper_space", RETURN_ON_ERROR))
swapper_space_nrpages = 0;
else
@@ -6796,7 +6796,8 @@ dump_kmeminfo(void)
* get swap data from dump_swap_info().
*/
fprintf(fp, "\n");
- if (dump_swap_info(RETURN_ON_ERROR, &totalswap_pages,
+ if (symbol_exists("swapper_space")) {
+ if (dump_swap_info(RETURN_ON_ERROR, &totalswap_pages,
&totalused_pages)) {
fprintf(fp, "%10s %7ld %11s ----\n",
"TOTAL SWAP", totalswap_pages,
@@ -6816,7 +6817,7 @@ dump_kmeminfo(void)
} else
error(INFO, "swap_info[%ld].swap_map at %lx is inaccessible\n",
totalused_pages, totalswap_pages);
-
+ }
dump_zone_page_usage();
}