mm: dump_page(): additional diagnostics for huge pinned pages
[linux-2.6-microblaze.git] / mm / ksm.c
index e45b02a..d17c7d5 100644 (file)
--- a/mm/ksm.c
+++ b/mm/ksm.c
@@ -885,13 +885,13 @@ static int remove_stable_node(struct stable_node *stable_node)
                return 0;
        }
 
-       if (WARN_ON_ONCE(page_mapped(page))) {
-               /*
-                * This should not happen: but if it does, just refuse to let
-                * merge_across_nodes be switched - there is no need to panic.
-                */
-               err = -EBUSY;
-       } else {
+       /*
+        * Page could be still mapped if this races with __mmput() running in
+        * between ksm_exit() and exit_mmap(). Just refuse to let
+        * merge_across_nodes/max_page_sharing be switched.
+        */
+       err = -EBUSY;
+       if (!page_mapped(page)) {
                /*
                 * The stable node did not yet appear stale to get_ksm_page(),
                 * since that allows for an unmapped ksm page to be recognized