]> Git Repo - linux.git/commitdiff
mm: shmem: avoid atomic operation during shmem_getpage_gfp
authorMel Gorman <[email protected]>
Wed, 4 Jun 2014 23:10:24 +0000 (16:10 -0700)
committerLinus Torvalds <[email protected]>
Wed, 4 Jun 2014 23:54:09 +0000 (16:54 -0700)
shmem_getpage_gfp uses an atomic operation to set the SwapBacked field
before it's even added to the LRU or visible.  This is unnecessary as what
could it possible race against?  Use an unlocked variant.

Signed-off-by: Mel Gorman <[email protected]>
Acked-by: Johannes Weiner <[email protected]>
Acked-by: Rik van Riel <[email protected]>
Cc: Vlastimil Babka <[email protected]>
Cc: Jan Kara <[email protected]>
Cc: Michal Hocko <[email protected]>
Cc: Hugh Dickins <[email protected]>
Cc: Dave Hansen <[email protected]>
Cc: Theodore Ts'o <[email protected]>
Cc: "Paul E. McKenney" <[email protected]>
Cc: Oleg Nesterov <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
include/linux/page-flags.h
mm/shmem.c

index d1fe1a761047683e555a9544dd5c668d5ae6752b..4d4b39ab2341ee182331dce062ab2fc2e90efe82 100644 (file)
@@ -208,6 +208,7 @@ PAGEFLAG(Pinned, pinned) TESTSCFLAG(Pinned, pinned) /* Xen */
 PAGEFLAG(SavePinned, savepinned);                      /* Xen */
 PAGEFLAG(Reserved, reserved) __CLEARPAGEFLAG(Reserved, reserved)
 PAGEFLAG(SwapBacked, swapbacked) __CLEARPAGEFLAG(SwapBacked, swapbacked)
+       __SETPAGEFLAG(SwapBacked, swapbacked)
 
 __PAGEFLAG(SlobFree, slob_free)
 
index 9f70e02111c6adcd090d8372ae0405b0f22b9abc..f47fb38c488994c062e9becc845e71ba6d9f80fe 100644 (file)
@@ -1132,7 +1132,7 @@ repeat:
                        goto decused;
                }
 
-               SetPageSwapBacked(page);
+               __SetPageSwapBacked(page);
                __set_page_locked(page);
                error = mem_cgroup_charge_file(page, current->mm,
                                                gfp & GFP_RECLAIM_MASK);
This page took 0.05447 seconds and 4 git commands to generate.