Commit dbd691d4 authored by Baolin Wang's avatar Baolin Wang Committed by Euler
Browse files

mm: shmem: drop folio reference count using 'nr_pages' in shmem_delete_from_page_cache()

mainline inclusion
from mainline-v6.12-rc1
commit 872339c31f3b2dd466320a5bed54abeccf0db47b
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/IAOMRL

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=872339c31f3b2dd466320a5bed54abeccf0db47b

--------------------------------

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: default avatarBaolin Wang <baolin.wang@linux.alibaba.com>
Cc: Barry Song <baohua@kernel.org>
Cc: Chris Li <chrisl@kernel.org>
Cc: Daniel Gomez <da.gomez@samsung.com>
Cc: David Hildenbrand <david@redhat.com>
Cc: "Huang, Ying" <ying.huang@intel.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Kefeng Wang <wangkefeng.wang@huawei.com>
Cc: Lance Yang <ioworker0@gmail.com>
Cc: Matthew Wilcox <willy@infradead.org>
Cc: Pankaj Raghav <p.raghav@samsung.com>
Cc: Ryan Roberts <ryan.roberts@arm.com>
Cc: Yang Shi <shy828301@gmail.com>
Cc: Zi Yan <ziy@nvidia.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarWang Lian <dev01404@linx-info.com>
---
parent 1b8e95fd
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -838,7 +838,7 @@ static void shmem_delete_from_page_cache(struct folio *folio, void *radswap)
	__lruvec_stat_mod_folio(folio, NR_SHMEM, -nr);
	shmem_reliable_folio_add(folio, -nr);
	xa_unlock_irq(&mapping->i_pages);
	folio_put(folio);
	folio_put_refs(folio, nr);
	BUG_ON(error);
}