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

mm: shmem: extend shmem_partial_swap_usage() to support large folio swap

mainline inclusion
from mainline-v6.12-rc1
commit 50f381eccefda0cdaf7aa617587dc04cb6652085
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=50f381eccefda0cdaf7aa617587dc04cb6652085

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

To support shmem large folio swapout in the following patches, using
xa_get_order() to get the order of the swap entry to calculate the swap
usage of shmem.

Link: https://lkml.kernel.org/r/60b130b9fc3e422bb91293a172c2113c85e9233a.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 129037a3
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -877,7 +877,7 @@ unsigned long shmem_partial_swap_usage(struct address_space *mapping,
		if (xas_retry(&xas, page))
			continue;
		if (xa_is_value(page))
			swapped++;
			swapped += 1 << xa_get_order(xas.xa, xas.xa_index);
		if (xas.xa_index == max)
			break;
		if (need_resched()) {