]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - mm/swap.c
Merge tag 'gfs2-for-5.6' of git://git.kernel.org/pub/scm/linux/kernel/git/gfs2/linux-gfs2
[linux.git] / mm / swap.c
index 5341ae93861f9a9d5aa603c855e5d17da61c79fa..cf39d24ada2acee01299c1eab39aaca7e79ea03e 100644 (file)
--- a/mm/swap.c
+++ b/mm/swap.c
@@ -813,8 +813,10 @@ void release_pages(struct page **pages, int nr)
                         * processing, and instead, expect a call to
                         * put_page_testzero().
                         */
-                       if (put_devmap_managed_page(page))
+                       if (page_is_devmap_managed(page)) {
+                               put_devmap_managed_page(page);
                                continue;
+                       }
                }
 
                page = compound_head(page);
@@ -1102,3 +1104,26 @@ void __init swap_setup(void)
         * _really_ don't want to cluster much more
         */
 }
+
+#ifdef CONFIG_DEV_PAGEMAP_OPS
+void put_devmap_managed_page(struct page *page)
+{
+       int count;
+
+       if (WARN_ON_ONCE(!page_is_devmap_managed(page)))
+               return;
+
+       count = page_ref_dec_return(page);
+
+       /*
+        * devmap page refcounts are 1-based, rather than 0-based: if
+        * refcount is 1, then the page is free and the refcount is
+        * stable because nobody holds a reference on the page.
+        */
+       if (count == 1)
+               free_devmap_managed_page(page);
+       else if (!count)
+               __put_page(page);
+}
+EXPORT_SYMBOL(put_devmap_managed_page);
+#endif