From: Baolin Wang Date: Mon, 12 Aug 2024 07:42:08 +0000 (+0800) Subject: mm: shmem: drop folio reference count using 'nr_pages' in shmem_delete_from_page_cache() X-Git-Tag: v6.12-rc1~115^2~222 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=872339c31f3b2dd466320a5bed54abeccf0db47b;p=thirdparty%2Fkernel%2Flinux.git mm: shmem: drop folio reference count using 'nr_pages' in shmem_delete_from_page_cache() To support large folio swapin/swapout for shmem in the following patches, drop the folio's reference count by the number of pages contained in the folio when a shmem folio is deleted from shmem pagecache after adding into swap cache. Link: https://lkml.kernel.org/r/b371eadb27f42fc51261c51008fbb9a334985b4c.1723434324.git.baolin.wang@linux.alibaba.com Signed-off-by: Baolin Wang Cc: Barry Song Cc: Chris Li Cc: Daniel Gomez Cc: David Hildenbrand Cc: "Huang, Ying" Cc: Hugh Dickins Cc: Kefeng Wang Cc: Lance Yang Cc: Matthew Wilcox Cc: Pankaj Raghav Cc: Ryan Roberts Cc: Yang Shi Cc: Zi Yan Signed-off-by: Andrew Morton --- diff --git a/mm/shmem.c b/mm/shmem.c index e63393ced0018..598d003b7a894 100644 --- a/mm/shmem.c +++ b/mm/shmem.c @@ -851,7 +851,7 @@ static void shmem_delete_from_page_cache(struct folio *folio, void *radswap) __lruvec_stat_mod_folio(folio, NR_FILE_PAGES, -nr); __lruvec_stat_mod_folio(folio, NR_SHMEM, -nr); xa_unlock_irq(&mapping->i_pages); - folio_put(folio); + folio_put_refs(folio, nr); BUG_ON(error); }