diff options
author | Andrew Morton <akpm@linux-foundation.org> | 2023-08-24 15:25:56 -0700 |
---|---|---|
committer | Andrew Morton <akpm@linux-foundation.org> | 2023-08-24 15:25:56 -0700 |
commit | fcbc329fa39ef261ba9072c56c63563423bff798 (patch) | |
tree | 2be4883f0089822d4436a8e6a5ba9032f9a025f5 /mm | |
parent | a644b0abbfe1d7cf775082cafdcc7b5f3c35becf (diff) | |
parent | e5548f85b4527c4c803b7eae7887c10bf8f90c97 (diff) | |
download | linux-stable-fcbc329fa39ef261ba9072c56c63563423bff798.tar.gz linux-stable-fcbc329fa39ef261ba9072c56c63563423bff798.tar.bz2 linux-stable-fcbc329fa39ef261ba9072c56c63563423bff798.zip |
merge mm-hotfixes-stable into mm-stable to pick up depended-upon changes
Diffstat (limited to 'mm')
-rw-r--r-- | mm/huge_memory.c | 2 | ||||
-rw-r--r-- | mm/madvise.c | 6 | ||||
-rw-r--r-- | mm/shmem.c | 6 |
3 files changed, 8 insertions, 6 deletions
diff --git a/mm/huge_memory.c b/mm/huge_memory.c index 213bb1e33830..cb4432792b88 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -1607,7 +1607,7 @@ bool madvise_free_huge_pmd(struct mmu_gather *tlb, struct vm_area_struct *vma, * If other processes are mapping this folio, we couldn't discard * the folio unless they all do MADV_FREE so let's skip the folio. */ - if (folio_mapcount(folio) != 1) + if (folio_estimated_sharers(folio) != 1) goto out; if (!folio_trylock(folio)) diff --git a/mm/madvise.c b/mm/madvise.c index 1fb2a11d77d9..b1f53a95e3a5 100644 --- a/mm/madvise.c +++ b/mm/madvise.c @@ -383,7 +383,7 @@ static int madvise_cold_or_pageout_pte_range(pmd_t *pmd, folio = pfn_folio(pmd_pfn(orig_pmd)); /* Do not interfere with other mappings of this folio */ - if (folio_mapcount(folio) != 1) + if (folio_estimated_sharers(folio) != 1) goto huge_unlock; if (pageout_anon_only_filter && !folio_test_anon(folio)) @@ -459,7 +459,7 @@ regular_folio: if (folio_test_large(folio)) { int err; - if (folio_mapcount(folio) != 1) + if (folio_estimated_sharers(folio) != 1) break; if (pageout_anon_only_filter && !folio_test_anon(folio)) break; @@ -683,7 +683,7 @@ static int madvise_free_pte_range(pmd_t *pmd, unsigned long addr, if (folio_test_large(folio)) { int err; - if (folio_mapcount(folio) != 1) + if (folio_estimated_sharers(folio) != 1) break; if (!folio_trylock(folio)) break; diff --git a/mm/shmem.c b/mm/shmem.c index 20daa207d8bf..99fb60ec2c3d 100644 --- a/mm/shmem.c +++ b/mm/shmem.c @@ -806,14 +806,16 @@ unsigned long shmem_partial_swap_usage(struct address_space *mapping, XA_STATE(xas, &mapping->i_pages, start); struct page *page; unsigned long swapped = 0; + unsigned long max = end - 1; rcu_read_lock(); - xas_for_each(&xas, page, end - 1) { + xas_for_each(&xas, page, max) { if (xas_retry(&xas, page)) continue; if (xa_is_value(page)) swapped++; - + if (xas.xa_index == max) + break; if (need_resched()) { xas_pause(&xas); cond_resched_rcu(); |