diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2022-01-22 10:43:07 +0200 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2022-01-22 10:43:07 +0200 |
commit | b68b10b6266009bc8770adf952d637250ee93135 (patch) | |
tree | 66944314c38fd57911bca88026d170df04bf9022 /mm | |
parent | 369af20a2c3f738c8610d75b010ee5dc5d3c207f (diff) | |
parent | 3abb28e275bfbe60136db37eae6679c3e1928cd5 (diff) | |
download | linux-b68b10b6266009bc8770adf952d637250ee93135.tar.bz2 |
Merge tag 'folio-5.17a' of git://git.infradead.org/users/willy/pagecache
Pull more folio updates from Matthew Wilcox:
"Three small folio patches.
One bug fix, one patch pulled forward from the patches destined for
5.18 and then a patch to make use of that functionality"
* tag 'folio-5.17a' of git://git.infradead.org/users/willy/pagecache:
filemap: Use folio_put_refs() in filemap_free_folio()
mm: Add folio_put_refs()
pagevec: Initialise folio_batch->percpu_pvec_drained
Diffstat (limited to 'mm')
-rw-r--r-- | mm/filemap.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/mm/filemap.c b/mm/filemap.c index 2fd9b2f24025..afc8f5ca85ac 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -231,17 +231,15 @@ void __filemap_remove_folio(struct folio *folio, void *shadow) void filemap_free_folio(struct address_space *mapping, struct folio *folio) { void (*freepage)(struct page *); + int refs = 1; freepage = mapping->a_ops->freepage; if (freepage) freepage(&folio->page); - if (folio_test_large(folio) && !folio_test_hugetlb(folio)) { - folio_ref_sub(folio, folio_nr_pages(folio)); - VM_BUG_ON_FOLIO(folio_ref_count(folio) <= 0, folio); - } else { - folio_put(folio); - } + if (folio_test_large(folio) && !folio_test_hugetlb(folio)) + refs = folio_nr_pages(folio); + folio_put_refs(folio, refs); } /** |