diff for duplicates of <20171127021835.GA27255@bbox> diff --git a/a/1.txt b/N1/1.txt index 04ea72c..37c06a2 100644 --- a/a/1.txt +++ b/N1/1.txt @@ -11,47 +11,47 @@ On Mon, Nov 20, 2017 at 09:40:56PM +0200, Ruslan Ruslichenko -X (rruslich - GLOB > readpage() callback. > Here is some backtrace for page fault handling to illustrate this: > -> 1) | handle_mm_fault() { -> 1) | filemap_fault() { -> 1) | __do_page_cache_readahead() -> 1) | add_to_page_cache_lru() -> 1) | squashfs_readpage() { -> 1) | squashfs_readpage_block() { -> 1) | squashfs_get_datablock() { -> 1) | squashfs_cache_get() { -> 1) | squashfs_read_data() { -> 1) | ll_rw_block() { -> 1) | submit_bh_wbc.isra.42() -> 1) | __wait_on_buffer() { -> 1) | io_schedule() { -> ------------------------------------------ -> 0) kworker-79 => <idle>-0 -> ------------------------------------------ -> 0) 0.382 us | blk_complete_request(); -> 0) | blk_done_softirq() { -> 0) | blk_update_request() { -> 0) | end_buffer_read_sync() -> 0) + 38.559 us | } -> 0) + 48.367 us | } -> ------------------------------------------ -> 0) kworker-79 => memhog-781 -> ------------------------------------------ -> 0) ! 278.848 us | } -> 0) ! 279.612 us | } -> 0) | squashfs_decompress() { -> 0) # 4919.082 us | squashfs_xz_uncompress(); -> 0) # 4919.864 us | } -> 0) # 5479.212 us | } /* squashfs_read_data */ -> 0) # 5479.749 us | } /* squashfs_cache_get */ -> 0) # 5480.177 us | } /* squashfs_get_datablock */ -> 0) | squashfs_copy_cache() { -> 0) 0.057 us | unlock_page(); -> 0) ! 142.773 us | } -> 0) # 5624.113 us | } /* squashfs_readpage_block */ -> 0) # 5628.814 us | } /* squashfs_readpage */ -> 0) # 5665.097 us | } /* __do_page_cache_readahead */ -> 0) # 5667.437 us | } /* filemap_fault */ -> 0) # 5672.880 us | } /* handle_mm_fault */ +> 1) | handle_mm_fault() { +> 1) | filemap_fault() { +> 1) | __do_page_cache_readahead() +> 1) | add_to_page_cache_lru() +> 1) | squashfs_readpage() { +> 1) | squashfs_readpage_block() { +> 1) | squashfs_get_datablock() { +> 1) | squashfs_cache_get() { +> 1) | squashfs_read_data() { +> 1) | ll_rw_block() { +> 1) | submit_bh_wbc.isra.42() +> 1) | __wait_on_buffer() { +> 1) | io_schedule() { +> ------------------------------------------ +> 0) kworker-79 => <idle>-0 +> ------------------------------------------ +> 0) 0.382 us | blk_complete_request(); +> 0) | blk_done_softirq() { +> 0) | blk_update_request() { +> 0) | end_buffer_read_sync() +> 0) + 38.559 us | } +> 0) + 48.367 us | } +> ------------------------------------------ +> 0) kworker-79 => memhog-781 +> ------------------------------------------ +> 0) ! 278.848 us | } +> 0) ! 279.612 us | } +> 0) | squashfs_decompress() { +> 0) # 4919.082 us | squashfs_xz_uncompress(); +> 0) # 4919.864 us | } +> 0) # 5479.212 us | } /* squashfs_read_data */ +> 0) # 5479.749 us | } /* squashfs_cache_get */ +> 0) # 5480.177 us | } /* squashfs_get_datablock */ +> 0) | squashfs_copy_cache() { +> 0) 0.057 us | unlock_page(); +> 0) ! 142.773 us | } +> 0) # 5624.113 us | } /* squashfs_readpage_block */ +> 0) # 5628.814 us | } /* squashfs_readpage */ +> 0) # 5665.097 us | } /* __do_page_cache_readahead */ +> 0) # 5667.437 us | } /* filemap_fault */ +> 0) # 5672.880 us | } /* handle_mm_fault */ > > As you can see squashfs_read_data() schedules IO by ll_rw_block() and then > it waits for IO to finish inside wait_on_buffer(). @@ -88,28 +88,22 @@ pressure. > @@ -126,9 +126,21 @@ static int read_pages(struct address_space *mapping, > struct file *filp, > -> for (page_idx = 0; page_idx < nr_pages; page_idx++) { -> struct page *page = lru_to_page(pages); -> + bool refault = false; -> + unsigned long mdflags; +> for (page_idx = 0; page_idx < nr_pages; page_idx++) { +> struct page *page = lru_to_page(pages); +> + bool refault = false; +> + unsigned long mdflags; > + -> list_del(&page->lru); -> - if (!add_to_page_cache_lru(page, mapping, page->index, gfp)) -> + if (!add_to_page_cache_lru(page, mapping, page->index, gfp)) { -> + if (!PageUptodate(page) && PageWorkingset(page)) { -> + memdelay_enter(&mdflags); -> + refault = true; -> + } +> list_del(&page->lru); +> - if (!add_to_page_cache_lru(page, mapping, page->index, gfp)) +> + if (!add_to_page_cache_lru(page, mapping, page->index, gfp)) { +> + if (!PageUptodate(page) && PageWorkingset(page)) { +> + memdelay_enter(&mdflags); +> + refault = true; +> + } > + -> mapping->a_ops->readpage(filp, page); +> mapping->a_ops->readpage(filp, page); > + -> + if (refault) -> + memdelay_leave(&mdflags); -> + } -> put_page(page); - --- -To unsubscribe, send a message with 'unsubscribe linux-mm' in -the body to majordomo@kvack.org. For more info on Linux MM, -see: http://www.linux-mm.org/ . -Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a> +> + if (refault) +> + memdelay_leave(&mdflags); +> + } +> put_page(page); diff --git a/a/content_digest b/N1/content_digest index 7824e28..4b1fd24 100644 --- a/a/content_digest +++ b/N1/content_digest @@ -31,47 +31,47 @@ "> readpage() callback.\n" "> Here is some backtrace for page fault handling to illustrate this:\n" "> \n" - "> 1) | handle_mm_fault() {\n" - "> 1) | filemap_fault() {\n" - "> 1) | __do_page_cache_readahead()\n" - "> 1) | add_to_page_cache_lru()\n" - "> 1) | squashfs_readpage() {\n" - "> 1) | squashfs_readpage_block() {\n" - "> 1) | squashfs_get_datablock() {\n" - "> 1) | squashfs_cache_get() {\n" - "> 1) | squashfs_read_data() {\n" - "> 1) | ll_rw_block() {\n" - "> 1) | submit_bh_wbc.isra.42()\n" - "> 1) | __wait_on_buffer() {\n" - "> 1) | io_schedule() {\n" - "> ------------------------------------------\n" - "> 0) kworker-79 => <idle>-0\n" - "> ------------------------------------------\n" - "> 0) 0.382 us | blk_complete_request();\n" - "> 0) | blk_done_softirq() {\n" - "> 0) | blk_update_request() {\n" - "> 0) | end_buffer_read_sync()\n" - "> 0) + 38.559 us | }\n" - "> 0) + 48.367 us | }\n" - "> ------------------------------------------\n" - "> 0) kworker-79 => memhog-781\n" - "> ------------------------------------------\n" - "> 0) ! 278.848 us | }\n" - "> 0) ! 279.612 us | }\n" - "> 0) | squashfs_decompress() {\n" - "> 0) # 4919.082 us | squashfs_xz_uncompress();\n" - "> 0) # 4919.864 us | }\n" - "> 0) # 5479.212 us | } /* squashfs_read_data */\n" - "> 0) # 5479.749 us | } /* squashfs_cache_get */\n" - "> 0) # 5480.177 us | } /* squashfs_get_datablock */\n" - "> 0) | squashfs_copy_cache() {\n" - "> 0) 0.057 us | unlock_page();\n" - "> 0) ! 142.773 us | }\n" - "> 0) # 5624.113 us | } /* squashfs_readpage_block */\n" - "> 0) # 5628.814 us | } /* squashfs_readpage */\n" - "> 0) # 5665.097 us | } /* __do_page_cache_readahead */\n" - "> 0) # 5667.437 us | } /* filemap_fault */\n" - "> 0) # 5672.880 us | } /* handle_mm_fault */\n" + "> \302\2401)\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240 |\302\240 handle_mm_fault() {\n" + "> \302\2401)\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240 |\302\240\302\240\302\240 filemap_fault() {\n" + "> \302\2401)\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240 |\302\240\302\240\302\240\302\240\302\240 __do_page_cache_readahead()\n" + "> \302\2401)\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240 |\302\240\302\240\302\240\302\240\302\240\302\240\302\240 add_to_page_cache_lru()\n" + "> \302\2401)\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240 |\302\240\302\240\302\240\302\240\302\240\302\240\302\240 squashfs_readpage() {\n" + "> \302\2401)\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240 |\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240 squashfs_readpage_block() {\n" + "> \302\2401)\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240 |\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240 squashfs_get_datablock() {\n" + "> \302\2401)\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240 |\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240 squashfs_cache_get() {\n" + "> \302\2401)\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240 |\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240 squashfs_read_data() {\n" + "> \302\2401)\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240 |\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240 ll_rw_block() {\n" + "> \302\2401)\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240 |\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240 submit_bh_wbc.isra.42()\n" + "> \302\2401)\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240 |\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240 __wait_on_buffer() {\n" + "> \302\2401)\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240 |\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240 io_schedule() {\n" + "> \302\240------------------------------------------\n" + "> \302\2400)\302\240\302\240 kworker-79\302\240\302\240 =>\302\240\302\240\302\240 <idle>-0\n" + "> \302\240------------------------------------------\n" + "> \302\2400)\302\240\302\240 0.382 us\302\240\302\240\302\240 |\302\240 blk_complete_request();\n" + "> \302\2400)\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240 |\302\240 blk_done_softirq() {\n" + "> \302\2400)\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240 |\302\240\302\240\302\240 blk_update_request() {\n" + "> \302\2400)\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240 |\302\240\302\240\302\240\302\240\302\240 end_buffer_read_sync()\n" + "> \302\2400) + 38.559 us\302\240\302\240 |\302\240\302\240\302\240 }\n" + "> \302\2400) + 48.367 us\302\240\302\240 |\302\240 }\n" + "> \302\240------------------------------------------\n" + "> \302\2400)\302\240\302\240 kworker-79\302\240\302\240 =>\302\240 memhog-781\n" + "> \302\240------------------------------------------\n" + "> \302\2400) ! 278.848 us\302\240 |\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240 }\n" + "> \302\2400) ! 279.612 us\302\240 |\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240 }\n" + "> \302\2400)\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240 |\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240 squashfs_decompress() {\n" + "> \302\2400) # 4919.082 us |\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240 squashfs_xz_uncompress();\n" + "> \302\2400) # 4919.864 us |\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240 }\n" + "> \302\2400) # 5479.212 us |\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240 } /* squashfs_read_data */\n" + "> \302\2400) # 5479.749 us |\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240 } /* squashfs_cache_get */\n" + "> \302\2400) # 5480.177 us |\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240 } /* squashfs_get_datablock */\n" + "> \302\2400)\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240 |\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240 squashfs_copy_cache() {\n" + "> \302\2400)\302\240\302\240 0.057 us\302\240\302\240\302\240 |\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240 unlock_page();\n" + "> \302\2400) ! 142.773 us\302\240 |\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240 }\n" + "> \302\2400) # 5624.113 us |\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240 } /* squashfs_readpage_block */\n" + "> \302\2400) # 5628.814 us |\302\240\302\240\302\240\302\240\302\240\302\240\302\240 } /* squashfs_readpage */\n" + "> \302\2400) # 5665.097 us |\302\240\302\240\302\240\302\240\302\240 } /* __do_page_cache_readahead */\n" + "> \302\2400) # 5667.437 us |\302\240\302\240\302\240 } /* filemap_fault */\n" + "> \302\2400) # 5672.880 us |\302\240 } /* handle_mm_fault */\n" "> \n" "> As you can see squashfs_read_data() schedules IO by ll_rw_block() and then\n" "> it waits for IO to finish inside wait_on_buffer().\n" @@ -108,30 +108,24 @@ "> @@ -126,9 +126,21 @@ static int read_pages(struct address_space *mapping,\n" "> struct file *filp,\n" "> \n" - "> for (page_idx = 0; page_idx < nr_pages; page_idx++) {\n" - "> struct page *page = lru_to_page(pages);\n" - "> + bool refault = false;\n" - "> + unsigned long mdflags;\n" + "> \302\240\302\240\302\240\302\240 for (page_idx = 0; page_idx < nr_pages; page_idx++) {\n" + "> \302\240\302\240\302\240\302\240 \302\240\302\240\302\240 struct page *page = lru_to_page(pages);\n" + "> +\302\240\302\240\302\240 \302\240\302\240\302\240 bool refault = false;\n" + "> +\302\240\302\240\302\240 \302\240\302\240\302\240 unsigned long mdflags;\n" "> +\n" - "> list_del(&page->lru);\n" - "> - if (!add_to_page_cache_lru(page, mapping, page->index, gfp))\n" - "> + if (!add_to_page_cache_lru(page, mapping, page->index, gfp)) {\n" - "> + if (!PageUptodate(page) && PageWorkingset(page)) {\n" - "> + memdelay_enter(&mdflags);\n" - "> + refault = true;\n" - "> + }\n" + "> \302\240\302\240\302\240\302\240 \302\240\302\240\302\240 list_del(&page->lru);\n" + "> -\302\240\302\240\302\240 \302\240\302\240\302\240 if (!add_to_page_cache_lru(page, mapping, page->index, gfp))\n" + "> +\302\240\302\240\302\240 \302\240\302\240\302\240 if (!add_to_page_cache_lru(page, mapping, page->index, gfp)) {\n" + "> +\302\240\302\240\302\240 \302\240\302\240\302\240 \302\240\302\240\302\240 if (!PageUptodate(page) && PageWorkingset(page)) {\n" + "> +\302\240\302\240\302\240 \302\240\302\240\302\240 \302\240\302\240\302\240 \302\240\302\240\302\240 memdelay_enter(&mdflags);\n" + "> +\302\240\302\240\302\240 \302\240\302\240\302\240 \302\240\302\240\302\240 \302\240\302\240\302\240 refault = true;\n" + "> +\302\240\302\240\302\240 \302\240\302\240\302\240 \302\240\302\240\302\240 }\n" "> +\n" - "> mapping->a_ops->readpage(filp, page);\n" + "> \302\240\302\240\302\240\302\240 \302\240\302\240\302\240 \302\240\302\240\302\240 mapping->a_ops->readpage(filp, page);\n" "> +\n" - "> + if (refault)\n" - "> + memdelay_leave(&mdflags);\n" - "> + }\n" - "> put_page(page);\n" - "\n" - "--\n" - "To unsubscribe, send a message with 'unsubscribe linux-mm' in\n" - "the body to majordomo@kvack.org. For more info on Linux MM,\n" - "see: http://www.linux-mm.org/ .\n" - "Don't email: <a href=mailto:\"dont@kvack.org\"> email@kvack.org </a>" + "> +\302\240\302\240\302\240 \302\240\302\240\302\240 \302\240\302\240\302\240 if (refault)\n" + "> +\302\240\302\240\302\240 \302\240\302\240\302\240 \302\240\302\240\302\240 \302\240\302\240\302\240 memdelay_leave(&mdflags);\n" + "> +\302\240\302\240\302\240 \302\240\302\240\302\240 }\n" + "> \302\240\302\240\302\240\302\240 \302\240\302\240\302\240 put_page(page);" -92611b994005b7dc514268ce219319222a00b1dae7144a82e2db77f1407fc622 +0f88aad4e8648ba58d1e7aa551f7927eec4a698f8aa14a687c71caa6de0769c5
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.