Description Sub-command "swap" in crash command doesn't show any info about swap partition in kernel versions 2.6.28 and above crash> swap FILENAME TYPE SIZE USED PCT PRIORITY crash> q feastlp4:~ # Analysis Swap specific information comes from the kernel data structure swap_info_struct .The problem starts when it access the fields of swap_info_struct. In this case ---------------------- flags = INT(vt->swap_info_struct + OFFSET(swap_info_struct_flags)); if (!(flags & SWP_USED)) continue; <== Hits this case ---------------------- flags gets value '0' and hence it returns with out calculating swap values This is happening because post 2.6.28 (precisely commit: ebebbbe904634b0ca1c674457b399f68db5e05b1) changes flag field in swap_info_struct from 'int' to 'unsigned long'. flags always gets zero and jumps further calculation. Fix Patch has been attached to this mail Thanks Sharyathi
Index: crash-5.0.1/memory.c =================================================================== --- crash-5.0.1.orig/memory.c 2010-02-17 15:21:24.000000000 -0600 +++ crash-5.0.1/memory.c 2010-04-07 02:20:01.000000000 -0500 @@ -11542,14 +11542,14 @@ dump_swap_info(ulong swapflags, ulong *totalswap_pages, ulong *totalused_pages) { int i, j; - int flags, swap_device, pages, prio, usedswap; - ulong swap_file, max, swap_map, pct; + int swap_device, pages, prio, usedswap, pct; + ulong flags, swap_file, max, swap_map; ulong vfsmnt; ulong swap_info, swap_info_ptr; ushort *smap; ulong inuse_pages, totalswap, totalused; char buf[BUFSIZE]; @@ -11579,8 +11579,12 @@ } else fill_swap_info(swap_info); - flags = INT(vt->swap_info_struct + - OFFSET(swap_info_struct_flags)); + if (THIS_KERNEL_VERSION >= LINUX(2,6,28)) + flags = ULONG(vt->swap_info_struct + + OFFSET(swap_info_struct_flags)); + else + flags = INT(vt->swap_info_struct + + OFFSET(swap_info_struct_flags)); if (!(flags & SWP_USED)) continue; @@ -11681,7 +11685,7 @@ pct = (usedswap * 100)/pages; if (swapflags & VERBOSE) - fprintf(fp, "%-15s %s %7dk %7dk %2ld%% %d\n", + fprintf(fp, "%-15s %s %7dk %7dk %2d%% %d\n", buf, swap_device ? "PARTITION" : " FILE ", pages, usedswap, pct, prio); }
-- Crash-utility mailing list Crash-utility@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/crash-utility