Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Fix "ps/vm" commands to display the memory usage for exiting tasks
When a task is exiting, usually kernel marks its flags as 'PF_EXITING',
but even so, sometimes the mm_struct has not been freed, it might still
be valid. For such tasks, the "ps/vm" commands won't display the memory
usage. For example:
crash> ps 47070
PID PPID CPU TASK ST %MEM VSZ RSS COMM
47070 1 0 ffff9ba7c4910000 UN 0.0 0 0 ra_ris.parse
crash> vm 47070
PID: 47070 TASK: ffff9ba7c4910000 CPU: 0 COMMAND: "ra_ris.parse"
MM PGD RSS TOTAL_VM
0 0 0k 0k
This is a corner case, but it has already occurred in actual production
environments. Given that, let's allow the "ps/vm" commands to try to
display the memory usage for this case. Note that it does not guarantee
that it can work well at any time, which still depends on how far the
mm_struct deconstruction has proceeded.
With the patch:
crash> ps 47070
PID PPID CPU TASK ST %MEM VSZ RSS COMM
47070 1 0 ffff9ba7c4910000 UN 90.8 38461228 31426444 ra_ris.parse
crash> vm 47070
PID: 47070 TASK: ffff9ba7c4910000 CPU: 0 COMMAND: "ra_ris.parse"
MM PGD RSS TOTAL_VM
ffff9bad6e873840 ffff9baee0544000 31426444k 38461228k
VMA START END FLAGS FILE
ffff9bafdbe1d6c8 400000 8c5000 8000875 /data1/rishome/ra_cu_cn_412/sbin/ra_ris.parse
...
Reported-by: Buland Kumar Singh <bsingh@redhat.com>
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>- Loading branch information