mm-batch-radix-tree-operations-when-truncating-pages.patch removed from -mm tree
The patch titled
Subject: mm: batch radix tree operations when truncating pages
has been removed from the -mm tree. Its filename was
mm-batch-radix-tree-operations-when-truncating-pages.patch
This patch was dropped because it was merged into mainline or a subsystem tree
------------------------------------------------------
From: Jan Kara <[email protected]>
Subject: mm: batch radix tree operations when truncating pages
Currently we remove pages from the radix tree one by one. To speed up page cache truncation, lock several pages at once and free them in one go. This allows us to batch radix tree operations in a more efficient way and also save round-trips on mapping->tree_lock. As a result we gain about 20% speed improvement in page cache truncation.
Data from a simple benchmark timing 10000 truncates of 1024 pages (on ext4 on ramdisk but the filesystem is barely visible in the profiles). The range shows 1% and 95% percentiles of the measured times:
4.14-rc2 4.14-rc2 + batched truncation
248-256 209-219
249-258 209-217
248-255 211-239
248-255 209-217
247-256 210-218
---
include/linux/pagemap.h | 4 + mm/filemap.c | 83 ++++++++++++++++++++++++++++++++++++++ mm/truncate.c | 20 ++++++++- 3 files changed, 105 insertions(+), 2 deletions(-)
include/linux/pagemap.h renamed from include/linux/pagemap.h~mm-batch-radix-tree-operations-when-truncating-pages +4 -0
@@ -16,6 +16,8 @@#include <linux/hardirq.h> /* for in_interrupt() */ #include <linux/hugetlb_inline.h> +struct pagevec ; +/* * Bits in mapping->flags. */
@@ -624,6 +626,8 @@ int add_to_page_cache_lru(struct page *pextern void delete_from_page_cache (struct page *page);extern void __delete_from_page_cache (struct page *page,void *shadow);int replace_page_cache_page (struct page *old,struct page *new,gfp_t gfp_mask); +void delete_from_page_cache_batch (struct address_space *mapping, +struct pagevec *pvec);/* * Like add_to_page_cache_locked, but used to add newly allocated pages:
mm/filemap.c renamed from mm/filemap.c~mm-batch-radix-tree-operations-when-truncating-pages +83 -0
89 lines not on this page · raw message
mm/truncate.c renamed from mm/truncate.c~mm-batch-radix-tree-operations-when-truncating-pages +18 -2
@@ -294,6 +294,14 @@ void truncate_inode_pages_range(struct awhile (index < end &&pagevec_lookup_entries (&pvec, mapping, index,min (end - index, (pgoff_t )PAGEVEC_SIZE ), indices)) { +/* +* Pagevec array has exceptional entries and we may also fail +* to lock some pages. So we store pages that can be deleted +* in a new pagevec. +*/ +struct pagevec locked_pvec; + +pagevec_init (&locked_pvec,0 );for (i =0 ; i <pagevec_count (&pvec); i++) {struct page *page = pvec.pages[i];
@@ -315,9 +323,17 @@ void truncate_inode_pages_range(struct aunlock_page (page);continue ; } -truncate_inode_page (mapping, page); -unlock_page (page); +if (page->mapping != mapping) { +unlock_page (page); +continue ; + } +pagevec_add (&locked_pvec, page); } +for (i =0 ; i <pagevec_count (&locked_pvec); i++) +truncate_cleanup_page (mapping, locked_pvec.pages[i]); +delete_from_page_cache_batch (mapping, &locked_pvec); +for (i =0 ; i <pagevec_count (&locked_pvec); i++) +unlock_page (locked_pvec.pages[i]);pagevec_remove_exceptionals (&pvec);pagevec_release (&pvec);cond_resched ();
_
Patches currently in -mm which might be from [email protected] are
mm-readahead-increase-maximum-readahead-window.patch