[Crash-utility] [PATCH] files: support dump file page cache

oliver yang yangoliver at gmail.com
Sat Jun 13 06:29:56 UTC 2015


Dave,

This patch add -M and -m option for file commands, which allow to dump
page cache for a file.

Please review and let me know your comments. Thanks!

Here is the usage,

1. Dump a process page cache number, default is crash, also work with given pid,

crash> files -M

PID: 22710  TASK: ffff8801077153e0  CPU: 1   COMMAND: "crash"

ROOT: /    CWD: /auto/home2/yango/workspace/crash

FD    ADDR-SPACE      PGCACHE-PGS         INODE       TYPE PATH

  0 ffff8801031edbe8         0        ffff8801031edaa0 CHR  /2

  1 ffff8801031edbe8         0        ffff8801031edaa0 CHR  /2

  2 ffff8801031edbe8         0        ffff8801031edaa0 CHR  /2

  3 ffff880139bf8950         0        ffff880139bf8808 CHR  /null

  4 ffff88011e561390         0        ffff88011e561248 CHR  /crash

  5 ffff88012f8345f0       37910      ffff88012f8344a8 REG
/usr/lib/debug/lib/modules/3.11.10-301.fc20.x86_64/vmlinux

  [snipped..........................]


2. Dump pages in a given addr-space, this exmaple is ffff88012f8345f0
from above output.
    page flags could indicates the dirty pages for fsync stress debugging,

crash> files -m ffff88012f8345f0

Address Space ffff88012f8345f0 : 37910 pages in page cache

      PAGE       PHYSICAL      MAPPING       INDEX CNT FLAGS

ffffea0001f5bc40 7d6f1000 ffff88012f8345f0        0  2 3ff0000000086c
referenced,uptodate,lru,active,private

ffffea0001f5bc80 7d6f2000 ffff88012f8345f0        1  2 3ff0000000082c
referenced,uptodate,lru,private

..............................[snipped...].........................................................................

ffffea00016226c0 5889b000 ffff88012f8345f0     9414  2 3ff0000000086c
referenced,uptodate,lru,active,private

ffffea000224f480 893d2000 ffff88012f8345f0     9415  2 3ff0000000086c
referenced,uptodate,lru,active,private

3. For each files doesn't work with -m but it work with -M

crash> foreach files -m

foreach: foreach files command does not support -m option

So we can use foreach to find which process or files have most page
cache number,

crash> foreach files -M | grep REG | sort -k3 -n | tail -10

20 ffff880137a70be0         2        ffff880137a70a98 REG  /ffinLFoAy

  4 ffff880037630de0        131       ffff880037630c98 REG
/var/log/audit/audit.log

  4 ffff880037630de0        131       ffff880037630c98 REG
/var/log/audit/audit.log

36 ffff8801352e91d8        574       ffff8801352e9090 REG
/var/log/journal/2d6f0d3073ff4a60b1e52a8e38e48feb/user-530.journal

34 ffff8801352e81f8        590       ffff8801352e80b0 REG
/var/log/journal/2d6f0d3073ff4a60b1e52a8e38e48feb/user-42.journal

  5 ffff8800a90219c8       9816       ffff8800a9021880 REG
/usr/lib/debug/lib/modules/3.11.10-301.fc20.x86_64/vmlinux

13 ffff880135267198       14051      ffff880135267050 REG
/var/log/journal/2d6f0d3073ff4a60b1e52a8e38e48feb/system.journal

  5 ffff88012f8345f0       37910      ffff88012f8344a8 REG
/usr/lib/debug/lib/modules/3.11.10-301.fc20.x86_64/vmlinux

  1 ffff8800704f3d80       59468      ffff8800704f3c38 REG
/ws/irqstat/nohup.out

  2 ffff8800704f3d80       59468      ffff8800704f3c38 REG
/ws/irqstat/nohup.out


With these commands, we can easily to debug some page cache flush
stress issue, and find out which process or files had the problem.


-- 
------------------
Oliver Yang
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-files-support-dump-file-page-caches.patch
Type: application/octet-stream
Size: 10454 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/crash-utility/attachments/20150613/95cec5cf/attachment.obj>


More information about the Crash-utility mailing list