[Crash-utility] [PATCH] Add -m option to kmem

Zhang Yanfei zhangyanfei at cn.fujitsu.com
Tue Mar 5 02:52:24 UTC 2013


于 2013年03月04日 23:24, Dave Anderson 写道:
> 
> 
> ----- Original Message -----
>> 于 2013年03月02日 05:20, Dave Anderson 写道:
>>>
>>>
>>> ----- Original Message -----
>>>> kmem -m is used for displaying information of all ksm pages or
>>>> some ksm pages for specified ksm stable tree node addresses
>>>> The information includes:
>>>>         - physical address of ksm page,
>>>>         - pid of tasks using this ksm page,
>>>>         - counts of ksm page references for each task
>>>>
>>>> for example:
>>>>     crash> kmem -m ffff8803573964c0
>>>>                  PID: 15864 16781
>>>>            793005000:  8713  5584
>>>>
>>>> ffff8803573964c0 is the address of ksm stable tree node.
>>>> task 15864 has 8713 virtual pages mapping the page with address 793005000.
>>>> task 16781 has 5584 virtual pages mapping the page with address 793005000.
>>>>
>>>> P.S.
>>>> This patch is based on the patch from
>>>> Qiao(qiaonuohan at cn.fujitsu.com)
>>>>     0001-make-rbtree-manipulation-functions-global.patch
>>>> Because this patch also uses rb_tree operations.
>>>
>>> I'll get to this patch after I get Qiao's patch straightened out and
>>> checked in.
>>>
>>> But a couple quick questions...
>>>
>>> What does "kmem -m" alone look like?  Your help page example only
>>> shows the command passing a "ksm stable tree node address".
>>
>> 'kmem -m' will display all the ksm pages.
> 
> I meant could you show an example of "kmem -m"...
> 
>>
>>> How would a user know what one of those addresses would be?
>>
>> From the structure "rmap_item" ? it has a member "head" that points
>> to a ksm stable tree node.
> 
> So does "kmem -m" show a list of those addresses?

oops...I misunderstood your question. The display is like:

crash> kmem -m
             PID:  3622  3512 
       867605000:   187  7671 

             PID:  3622  3512 
       465837000:     1     1 

             PID:  3622  3512 
       465803000:     1     1 

             PID:  3512 
       4643d0000:     2 

             PID:  3512 
       81bddc000:     2 

             PID:  3512 
       841c36000:     2 

             PID:  3512 
       4653e5000:     2 

             PID:  3512 
       842bc1000:     3 

             PID:  3512 
       455b4b000:    11 

             PID:  3512 
       453842000:     3 
......

All ksm pages are displayed. For every ksm page, for example
a ksm page with physical address 867605000, has two tasks 
reference it: 3622 and 3512. 3622 has 187 virtual mappings
into the ksm page and 3512 has 7671 virtual mappings into
the ksm page.

             PID:  3622  3512
       867605000:   187  7671


> 
>>>
>>> And for "kmem -m <address>", what if there are dozens of PIDs that
>>> are mapping the same physical address?  Regardless of the size of
>>> the display window, eventually it would get messy if it extends to
>>> more than one line.  I try to avoid having commands extend beyond
>>> 80 columns if at all possible.
>>>
>>
>> Hmm. If there are quite many PIDs, can the output be like below?
>>
>>              PID: 15864 16781 16782 16783
>>        793005000:  8713  5584    23    23
>>                   12222 13333 14444 15555
>>                     232   232   334   456
>>                   ...
> 
> Well, that's not much clearer -- it's difficult to tell whether the
> numbers are PIDs or counts.

Do you have any suggestions...





More information about the Crash-utility mailing list