Attached is patch which seems to fix problem on my system.  I'm not sure
whether cond_resched() is necessary in failure path when add fails (err
!= -ENOMEM), as I cannot trigger that path in the test, but one in
EEXIST path is rather vital...

Signed-off-by: Petr Vandrovec <p...@vandrovec.name>

--- a/mm/swap_state.c
+++ b/mm/swap_state.c
@@ -293,8 +293,10 @@ struct page *read_swap_cache_async(swp_entry_t entry, 
gfp_t gfp_mask,
                 * Swap entry may have been freed since our caller observed it.
                 */
                err = swapcache_prepare(entry);
-               if (err == -EEXIST) /* seems racy */
+               if (err == -EEXIST) { /* seems racy */
+                       cond_resched();
                        continue;
+               }
                if (err)           /* swp entry is obsolete ? */
                        break;
 
@@ -320,6 +322,8 @@ struct page *read_swap_cache_async(swp_entry_t entry, gfp_t 
gfp_mask,
                ClearPageSwapBacked(new_page);
                __clear_page_locked(new_page);
                swapcache_free(entry, NULL);
+               if (err != -ENOMEM)
+                       cond_resched();
        } while (err != -ENOMEM);
 
        if (new_page)


** Attachment added: "Add cond_resched to swap_state.c"
   http://launchpadlibrarian.net/32140999/x2.diff

-- 
Kernel hang under memory stress
https://bugs.launchpad.net/bugs/433646
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to