[Crash-utility] Thoughts on swap_usage Crash extension?

Aaron Tomlin atomlin at redhat.com
Wed Feb 6 15:55:52 UTC 2013


Hi Dave,

Thanks for your suggestions.
The latest version is here [1].

Cheers,
Aaron

[1]: https://github.com/aktlin115/crash-extension/blob/master/swap_usage.c

----- Original Message -----
From: "Dave Anderson" <anderson at redhat.com>
To: "Discussion list for crash utility usage, maintenance and development" <crash-utility at redhat.com>
Sent: Monday, February 4, 2013 8:13:29 PM
Subject: Re: [Crash-utility] Thoughts on swap_usage Crash extension?



----- Original Message -----
> Hi Dave, Bryn,
> 
> I've made some changes (see the attachments) to support the
> following:
> 
> 	ARM, X86, X86_64, ALPHA, IA64 and S390
> 
> Unfortunately these are the only definitions I could find at the moment.
> As per your suggestion, the command name has been changed to "pswap" which
> is more appropriate and the extension displays the swap count in pages by default.
> The '-k' option is added to display in kilobytes.
> 
> The latest version is here [1].
> 
> Cheers,
> 
> Aaron

Hi Aaron,

Looks good, architecture-restrictions notwithstanding.  With respect to
the -k option, maybe it would be helpful to add a "k" to the end of the
number, similar to the way it's done by the swap command?

 crash> swap
 FILENAME           TYPE         SIZE      USED   PCT  PRIORITY
 /dev/dm-0        PARTITION    9994236k   30980k   0%     0
 crash>

The only other suggestion would be to make the help page a bit more
consistent with the other help pages: 

 crash> help pswap

 NAME
   pswap - Returns the actual swap consumption of a user process

 SYNOPSIS
   pswap [-k] [pid | taskp]

 DESCRIPTION
   This command obtains the swap consumption (in pages) of a user process.
   The -k option can be used to print in kilobytes.  Supported on ARM, X86, X86_64, ALPHA, IA64 and S390 only.

 EXAMPLE
     Show the swap consumption for pid 1288, 1232 and 663:

         crash> pswap 1288 1232 663
         PID     SWAP     COMM
          1288   2100    audispd
          1232    188    bluetoothd
           663   3384    udevd
         crash>
 
 If no arguments are specified, every user process will be checked.

 crash>

so that:

 (1) all lines are 80 columns or less, 
 (2) the "If not arguments are specified..." line is moved up into the DESCRIPTION section.
 (3) the EXAMPLE text is moved to the left, i,e., similar to other help page examples.

I've copied this latest version to the extensions page.

Thanks,
  Dave

> ---
> [1]:
> https://github.com/aktlin115/crash-extension/blob/master/swap_usage.c
> 
> ----- Original Message -----
> From: "Dave Anderson" <anderson at redhat.com>
> To: "Discussion list for crash utility usage, maintenance and
> development" <crash-utility at redhat.com>
> Sent: Wednesday, January 30, 2013 2:41:21 PM
> Subject: Re: [Crash-utility] Thoughts on swap_usage Crash extension?
> 
> 
> Aaron,
> 
> Bryn's name change and pte_file() suggestion make good sense.
> 
> I also wonder if it's worth adding an option to alternatively display
> the swap count in pages?  The only crash commands I can think of
> off-hand that use kilobytes are the "ps" and "swap" commands, and
> those were done that way because of the Linux commands of the same
> name.  But when I want to see how much swap a process is using I
> do this to get a page count:
> 
>  crash> vm -p 1 | grep SWAP | wc -l
>  382
>  crash>
> 
> Or maybe just show both all the time?  Just a thought...
> 
> In any case, I've put the module in the crash extensions page as-is
> for now.  When you're ready to update it, I'll just plug in your
> latest-and-greatest version.
> 
>   http://people.redhat.com/anderson/extensions.html
> 
> Thanks,
>   Dave
> 
> ----- Original Message -----
> > Hi Bryn,
> > 
> > Thanks for the feedback.
> > I'll work on it. With regards to the name change, I think it's
> > worth
> > changing it to 'pswap'.
> > 
> > Cheers,
> > Aaron
> > 
> > ----- Original Message -----
> > From: "Bryn M. Reeves" <bmr at redhat.com>
> > To: "Discussion list for crash utility usage, maintenance and
> > development" <crash-utility at redhat.com>
> > Cc: "Aaron Tomlin" <atomlin at redhat.com>
> > Sent: Wednesday, January 30, 2013 1:51:35 PM
> > Subject: Re: [Crash-utility] Thoughts on swap_usage Crash
> > extension?
> > 
> > -----BEGIN PGP SIGNED MESSAGE-----
> > Hash: SHA1
> > 
> > On 01/30/2013 01:17 PM, Aaron Tomlin wrote:
> > > I've made some changes [1] and included the help page, as per
> > > your
> > > request. It's still x86_64 specific for now. What do you think?
> > > [1]:
> > > https://github.com/aktlin115/crash-extension/blob/master/swap_usage.c
> > 
> > Hi
> > > 
> > Aaron,
> > 
> > Extension looks useful. I was wondering about the name - would you
> > consider renaming it as 'pswap'? It's less to type than swap_usage
> > (as
> > there's already a 'swap' command but nothing 'psw*').
> > 
> > For the _PAGE_FILE problem it might be possible to address this by
> > providing a wrapper like the pte_file() interface defined by arch
> > headers in the kernel sources.
> > 
> > There seem to be 11 arches (inc. x86 and powerpc) using
> > (pte_val(pte)
> > & _PAGE_FILE) idiom. Of the rest s390 has a well-commented
> > explanation
> > of its special cases and ARM uses a different name for the bit:
> > 
> > #define pte_file(pte)		(pte_val(pte) & L_PTE_FILE)
> > 
> > It seems like these could all be handled quite reasonably (actually
> > the number that are identical maybe it's the case that this could
> > be
> > tidied up in the kernel so that arches that really need custom
> > versions can override pte_file() but that's not really my area).
> > 
> > Regards,
> > Bryn.
> > -----BEGIN PGP SIGNATURE-----
> > Version: GnuPG v1.4.12 (GNU/Linux)
> > Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
> > 
> > iEYEARECAAYFAlEJJWcACgkQ6YSQoMYUY97PKwCfa6ZuC2MuTrYa2E42WSEkBPjM
> > 234An1RQFlRxrDFgMu/cxdhEMzfsRGGZ
> > =VY7a
> > -----END PGP SIGNATURE-----
> > 
> > --
> > Crash-utility mailing list
> > Crash-utility at redhat.com
> > https://www.redhat.com/mailman/listinfo/crash-utility
> > 
> 
> --
> Crash-utility mailing list
> Crash-utility at redhat.com
> https://www.redhat.com/mailman/listinfo/crash-utility
> --
> Crash-utility mailing list
> Crash-utility at redhat.com
> https://www.redhat.com/mailman/listinfo/crash-utility

--
Crash-utility mailing list
Crash-utility at redhat.com
https://www.redhat.com/mailman/listinfo/crash-utility




More information about the Crash-utility mailing list