[Crash-utility] [PATCH] improve the performance of kmem -s [address]

Dave Anderson anderson at redhat.com
Fri Feb 3 13:47:53 UTC 2012



----- Original Message -----
> At 2012-2-3 15:19, qiaonuohan wrote:
> > At 2012-2-3 1:24, Dave Anderson wrote:
> >> But in other circumstances where there may be ambiguity, I've put
> >> in the option of putting a "\" in front of the name, i.e., you
> >> could do something like:
> >>
> >> crash> kmem -s list
> >> ffff880079e44a00 nfs_read_data
> >> ffff880079e44700 nfs_inode_cache
> >> ffff880079e44d00 fscache_cookie_jar
> >> ...
> >>
> >> crash> kmem -s \list
> >> CACHE NAME OBJSIZE ALLOCATED TOTAL SLABS SSIZE
> >> ffff88007b895400 list 240 0 0 0 4k
> >> crash>
> >>
> >> That would be simple enough fix in cmd_kmem() if you re-work this
> >> part:
> >>
> >> if (sflag == 1) {
> >> if (STREQ(meminfo.reqname, "list"))
> >> kmem_cache_list();
> >> else if (vt->flags& KMEM_CACHE_UNAVAIL)
> >> error(FATAL,
> >> "kmem cache slab subsystem not available\n");
> >> else
> >> vt->dump_kmem_cache(&meminfo);
> >> }
> > Hello Dave,
> >
> > Thanks for your advice! But after some investigation, "\list" may also
> > involve ambiguity. I created a kmem_cache called "\list", the original
> > code can display the following information after executing "kmem -s
> > \list".
> >
> > crash> kmem -s \list
> > CACHE NAME OBJSIZE ALLOCATED TOTAL SLABS SSIZE
> > ffff880874b30c40 \list 8 0 0 0 4k
> > crash>
> >
> > Need to use "\\list" to refer the kmem_cache called "\list" if code is
> > changed? Please! I find it is better to remain the original code.  Could
> > you give me some tips?
> >
> 
> I figured out a style of the command which seems somewhat suitable.  If
> the "name" of "kmem -s <name>" starts with a "\", neglect it and search
> the slab by the remaining part. 
> Some examples are listed below:
> 
> command argument                 slab name
> --------------------------------------------
> \list                            list
> \\list                           \list
> \\\list                          \\list
> kvm_vcpu                         kvm_vcpu
> \kvm_vcpu                        kvm_vcpu
> \\kvm_vcpu                       \kvm_vcpu
> 
> Is this acceptable? If so, I will do the fix like this.
 
That is what I meant by my original suggestion, i.e., the same thing
that is done by the "foreach <name>" and "ps <command>" options to
handle potential ambiguities:

  crash> help ps
  ...
     command  a command name.  If a command name is made up of letters that
              are all numerical values, precede the name string with a "\".
  ...

  crash> help foreach
  ...
       name  perform the command(s) on all commands with this name.  If the
             command name can be confused with a foreach command name, then
             precede the name string with a "\".
  ...
  
Dave
 




More information about the Crash-utility mailing list