The patch titled mm: clarify __add_to_swap_cache locking has been removed from the -mm tree. Its filename was mm-clarify-__add_to_swap_cache-locking.patch This patch was dropped because it was merged into mainline or a subsystem tree ------------------------------------------------------ Subject: mm: clarify __add_to_swap_cache locking From: Nick Piggin <npiggin@xxxxxxx> __add_to_swap_cache unconditionally sets the page locked, which can be a bit alarming to the unsuspecting reader: in the code paths where the page is visible to other CPUs, the page should be (and is) already locked. Instead, just add a check to ensure the page is locked here, and teach the one path relying on the old behaviour to call SetPageLocked itself. [hugh@xxxxxxxxxxx: locking fix] Signed-off-by: Nick Piggin <npiggin@xxxxxxx> Signed-off-by: Hugh Dickins <hugh@xxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/swap_state.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff -puN mm/swap_state.c~mm-clarify-__add_to_swap_cache-locking mm/swap_state.c --- a/mm/swap_state.c~mm-clarify-__add_to_swap_cache-locking +++ a/mm/swap_state.c @@ -74,6 +74,7 @@ static int __add_to_swap_cache(struct pa { int error; + BUG_ON(!PageLocked(page)); BUG_ON(PageSwapCache(page)); BUG_ON(PagePrivate(page)); error = radix_tree_preload(gfp_mask); @@ -83,7 +84,6 @@ static int __add_to_swap_cache(struct pa entry.val, page); if (!error) { page_cache_get(page); - SetPageLocked(page); SetPageSwapCache(page); set_page_private(page, entry.val); total_swapcache_pages++; @@ -99,15 +99,18 @@ static int add_to_swap_cache(struct page { int error; + BUG_ON(PageLocked(page)); if (!swap_duplicate(entry)) { INC_CACHE_INFO(noent_race); return -ENOENT; } + SetPageLocked(page); error = __add_to_swap_cache(page, entry, GFP_KERNEL); /* * Anon pages are already on the LRU, we don't run lru_cache_add here. */ if (error) { + ClearPageLocked(page); swap_free(entry); if (error == -EEXIST) INC_CACHE_INFO(exist_race); _ Patches currently in -mm which might be from npiggin@xxxxxxx are origin.patch mm-document-tree_lock-zonelock-lockorder.patch fs-reiserfs-cleanups.patch atomic_opstxt-has-incorrect-misleading-and-insufficient-information.patch fs-introduce-write_begin-write_end-and-perform_write-aops-revoke.patch fs-introduce-write_begin-write_end-and-perform_write-aops-revoke-fix.patch bitops-introduce-lock-ops.patch alpha-fix-bitops.patch alpha-lock-bitops.patch alpha-lock-bitops-fix.patch ia64-lock-bitops.patch mips-fix-bitops.patch mips-lock-bitops.patch powerpc-lock-bitops.patch powerpc-lock-bitops-fix.patch bit_spin_lock-use-lock-bitops.patch reiser4-fix-for-new-aops-patches.patch - To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html