summaryrefslogtreecommitdiffstats
path: root/mm/migrate.c
diff options
context:
space:
mode:
authorHugh Dickins <hughd@google.com>2016-05-19 20:12:41 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2016-05-19 22:12:14 -0400
commitfa9949da59a15017a02c86b087c7499d7b5702be (patch)
tree1191eac8b64eb3ba21b1286d9f3842db0388af82 /mm/migrate.c
parent9d5e6a9f22311b00a20ff9b072760ad3e73f0d99 (diff)
mm: use __SetPageSwapBacked and dont ClearPageSwapBacked
v3.16 commit 07a427884348 ("mm: shmem: avoid atomic operation during shmem_getpage_gfp") rightly replaced one instance of SetPageSwapBacked by __SetPageSwapBacked, pointing out that the newly allocated page is not yet visible to other users (except speculative get_page_unless_zero- ers, who may not update page flags before their further checks). That was part of a series in which Mel was focused on tmpfs profiles: but almost all SetPageSwapBacked uses can be so optimized, with the same justification. Remove ClearPageSwapBacked from __read_swap_cache_async() error path: it's not an error to free a page with PG_swapbacked set. Follow a convention of __SetPageLocked, __SetPageSwapBacked instead of doing it differently in different places; but that's for tidiness - if the ordering actually mattered, we should not be using the __variants. There's probably scope for further __SetPageFlags in other places, but SwapBacked is the one I'm interested in at the moment. Signed-off-by: Hugh Dickins <hughd@google.com> Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com> Cc: Andrea Arcangeli <aarcange@redhat.com> Cc: Andres Lagar-Cavilla <andreslc@google.com> Cc: Yang Shi <yang.shi@linaro.org> Cc: Ning Qu <quning@gmail.com> Reviewed-by: Mel Gorman <mgorman@techsingularity.net> Cc: Konstantin Khlebnikov <koct9i@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/migrate.c')
-rw-r--r--mm/migrate.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/mm/migrate.c b/mm/migrate.c
index f9dfb18a4eba..53ab6398e7a2 100644
--- a/mm/migrate.c
+++ b/mm/migrate.c
@@ -332,7 +332,7 @@ int migrate_page_move_mapping(struct address_space *mapping,
332 newpage->index = page->index; 332 newpage->index = page->index;
333 newpage->mapping = page->mapping; 333 newpage->mapping = page->mapping;
334 if (PageSwapBacked(page)) 334 if (PageSwapBacked(page))
335 SetPageSwapBacked(newpage); 335 __SetPageSwapBacked(newpage);
336 336
337 return MIGRATEPAGE_SUCCESS; 337 return MIGRATEPAGE_SUCCESS;
338 } 338 }
@@ -378,7 +378,7 @@ int migrate_page_move_mapping(struct address_space *mapping,
378 newpage->index = page->index; 378 newpage->index = page->index;
379 newpage->mapping = page->mapping; 379 newpage->mapping = page->mapping;
380 if (PageSwapBacked(page)) 380 if (PageSwapBacked(page))
381 SetPageSwapBacked(newpage); 381 __SetPageSwapBacked(newpage);
382 382
383 get_page(newpage); /* add cache reference */ 383 get_page(newpage); /* add cache reference */
384 if (PageSwapCache(page)) { 384 if (PageSwapCache(page)) {
@@ -1791,7 +1791,7 @@ int migrate_misplaced_transhuge_page(struct mm_struct *mm,
1791 1791
1792 /* Prepare a page as a migration target */ 1792 /* Prepare a page as a migration target */
1793 __SetPageLocked(new_page); 1793 __SetPageLocked(new_page);
1794 SetPageSwapBacked(new_page); 1794 __SetPageSwapBacked(new_page);
1795 1795
1796 /* anon mapping, we can simply copy page->mapping to the new page: */ 1796 /* anon mapping, we can simply copy page->mapping to the new page: */
1797 new_page->mapping = page->mapping; 1797 new_page->mapping = page->mapping;