Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux...
[linux-block.git] / mm / memory-failure.c
index b852b10ec76d8b9acc7fbc231f099d9a03155eda..d487f8dc6d392ab7663c2e63317f12e29e37e743 100644 (file)
@@ -233,29 +233,17 @@ void shake_page(struct page *p, int access)
                lru_add_drain_all();
                if (PageLRU(p))
                        return;
-               drain_all_pages();
+               drain_all_pages(page_zone(p));
                if (PageLRU(p) || is_free_buddy_page(p))
                        return;
        }
 
        /*
-        * Only call shrink_slab here (which would also shrink other caches) if
-        * access is not potentially fatal.
+        * Only call shrink_node_slabs here (which would also shrink
+        * other caches) if access is not potentially fatal.
         */
-       if (access) {
-               int nr;
-               int nid = page_to_nid(p);
-               do {
-                       struct shrink_control shrink = {
-                               .gfp_mask = GFP_KERNEL,
-                       };
-                       node_set(nid, shrink.nodes_to_scan);
-
-                       nr = shrink_slab(&shrink, 1000, 1000);
-                       if (page_count(p) == 1)
-                               break;
-               } while (nr > 10);
-       }
+       if (access)
+               drop_slab_node(page_to_nid(p));
 }
 EXPORT_SYMBOL_GPL(shake_page);
 
@@ -466,7 +454,7 @@ static void collect_procs_file(struct page *page, struct list_head *to_kill,
        struct task_struct *tsk;
        struct address_space *mapping = page->mapping;
 
-       mutex_lock(&mapping->i_mmap_mutex);
+       i_mmap_lock_read(mapping);
        read_lock(&tasklist_lock);
        for_each_process(tsk) {
                pgoff_t pgoff = page_to_pgoff(page);
@@ -488,7 +476,7 @@ static void collect_procs_file(struct page *page, struct list_head *to_kill,
                }
        }
        read_unlock(&tasklist_lock);
-       mutex_unlock(&mapping->i_mmap_mutex);
+       i_mmap_unlock_read(mapping);
 }
 
 /*
@@ -1659,9 +1647,7 @@ static int __soft_offline_page(struct page *page, int flags)
                         * setting PG_hwpoison.
                         */
                        if (!is_free_buddy_page(page))
-                               lru_add_drain_all();
-                       if (!is_free_buddy_page(page))
-                               drain_all_pages();
+                               drain_all_pages(page_zone(page));
                        SetPageHWPoison(page);
                        if (!is_free_buddy_page(page))
                                pr_info("soft offline: %#lx: page leaked\n",