• X
    alinux: fs: record page or bio info while process is waitting on it · 2864376f
    Xiaoguang Wang 提交于
    If one process context is stucked in wait_on_buffer(), lock_buffer(),
    lock_page() and wait_on_page_writeback() and wait_on_bit_io(), it's
    hard to tell ture reason, for example, whether this page is under io,
    or this page is just locked too long by other process context.
    
    Normally io request has multiple bios, and every bio contains multiple
    pages which will hold data to be read from or written to device, so here
    we record page info or bio info in task_struct while process calls
    lock_page(), lock_buffer(), wait_on_page_writeback(), wait_on_buffer()
    and wait_on_bit_io(), we add a new proce interface:
    [lege@localhost linux]$ cat /proc/4516/wait_res
    1 ffffd0969f95d3c0 4295369599 4295381596
    
    Above info means that thread 4516 is waitting on a page, address is
    ffffd0969f95d3c0, and has waited for 11997ms.
    
    First field denotes the page address process is waitting on.
    Second field denotes the wait moment and the third denotes current moment.
    
    In practice, if we found a process waitting on one page for too long time,
    we can get page's address by reading /proc/$pid/wait_page, and search this
    page address in all block devices' /sys/kernel/debug/block/${devname}/rq_hang,
    if search operation hits one, we can get the request and know why this io
    request hangs that long.
    Reviewed-by: NJoseph Qi <joseph.qi@linux.alibaba.com>
    Signed-off-by: NXiaoguang Wang <xiaoguang.wang@linux.alibaba.com>
    2864376f
transaction.c 81.1 KB