[Crash-utility] [PATCH]Fixing swap command

Sharyathi Nagesh sharyath at in.ibm.com
Wed Apr 7 12:01:43 UTC 2010


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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fix_swap_command.patch
Type: text/x-patch
Size: 1348 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/crash-utility/attachments/20100407/c06acbdb/attachment.bin>


More information about the Crash-utility mailing list