From 7815688a4af17361d694c5844a8e81f90e80c1ce Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Fri, 28 Sep 2012 10:19:08 +1000 Subject: [PATCH] mm-fix-nonuniform-page-status-when-writing-new-file-with-small-buffer-fix-fix grab better comment from the v3 patch Cc: Johannes Weiner Cc: KOSAKI Motohiro Cc: Minchan Kim Cc: Robin Dong Cc: Wu Fengguang Signed-off-by: Andrew Morton --- mm/swap.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/mm/swap.c b/mm/swap.c index 7a555e227d61..f76c76c7501b 100644 --- a/mm/swap.c +++ b/mm/swap.c @@ -447,8 +447,12 @@ void mark_page_accessed(struct page *page) EXPORT_SYMBOL(mark_page_accessed); /* - * Check the pagevec space before adding a new page into it, to prevent - * nonuniform page status in mark_page_accessed() after __lru_cache_add(). + * Order of operations is important: flush the pagevec when it's already + * full, not when adding the last page, to make sure that last page is + * not added to the LRU directly when passed to this function. Because + * mark_page_accessed() (called after this when writing) only activates + * pages that are on the LRU, linear writes in subpage chunks would see + * every PAGEVEC_SIZE page activated, which is unexpected. */ void __lru_cache_add(struct page *page, enum lru_list lru) { -- 2.39.5