Merge tag 'docs-4.5' of git://git.lwn.net/linux
[linux-drm-fsl-dcu.git] / mm / rmap.c
index b577fbb98d4baf352fa5e51cc536d02356b8392e..622756c16ac84ccc905355d3d6b59a9b9dca35e4 100644 (file)
--- a/mm/rmap.c
+++ b/mm/rmap.c
@@ -428,8 +428,10 @@ static void anon_vma_ctor(void *data)
 void __init anon_vma_init(void)
 {
        anon_vma_cachep = kmem_cache_create("anon_vma", sizeof(struct anon_vma),
-                       0, SLAB_DESTROY_BY_RCU|SLAB_PANIC, anon_vma_ctor);
-       anon_vma_chain_cachep = KMEM_CACHE(anon_vma_chain, SLAB_PANIC);
+                       0, SLAB_DESTROY_BY_RCU|SLAB_PANIC|SLAB_ACCOUNT,
+                       anon_vma_ctor);
+       anon_vma_chain_cachep = KMEM_CACHE(anon_vma_chain,
+                       SLAB_PANIC|SLAB_ACCOUNT);
 }
 
 /*
@@ -1362,10 +1364,7 @@ static int try_to_unmap_one(struct page *page, struct vm_area_struct *vma,
                if (PageHuge(page)) {
                        hugetlb_count_sub(1 << compound_order(page), mm);
                } else {
-                       if (PageAnon(page))
-                               dec_mm_counter(mm, MM_ANONPAGES);
-                       else
-                               dec_mm_counter(mm, MM_FILEPAGES);
+                       dec_mm_counter(mm, mm_counter(page));
                }
                set_pte_at(mm, address, pte,
                           swp_entry_to_pte(make_hwpoison_entry(page)));
@@ -1375,10 +1374,7 @@ static int try_to_unmap_one(struct page *page, struct vm_area_struct *vma,
                 * interest anymore. Simply discard the pte, vmscan
                 * will take care of the rest.
                 */
-               if (PageAnon(page))
-                       dec_mm_counter(mm, MM_ANONPAGES);
-               else
-                       dec_mm_counter(mm, MM_FILEPAGES);
+               dec_mm_counter(mm, mm_counter(page));
        } else if (IS_ENABLED(CONFIG_MIGRATION) && (flags & TTU_MIGRATION)) {
                swp_entry_t entry;
                pte_t swp_pte;
@@ -1418,7 +1414,7 @@ static int try_to_unmap_one(struct page *page, struct vm_area_struct *vma,
                        swp_pte = pte_swp_mksoft_dirty(swp_pte);
                set_pte_at(mm, address, pte, swp_pte);
        } else
-               dec_mm_counter(mm, MM_FILEPAGES);
+               dec_mm_counter(mm, mm_counter_file(page));
 
        page_remove_rmap(page);
        page_cache_release(page);