* + mm-convert-mm_counter_file-to-take-a-folio.patch added to mm-unstable branch
@ 2024-01-11 20:32 Andrew Morton
0 siblings, 0 replies; only message in thread
From: Andrew Morton @ 2024-01-11 20:32 UTC (permalink / raw)
To: mm-commits, willy, david, wangkefeng.wang, akpm
The patch titled
Subject: mm: convert mm_counter_file() to take a folio
has been added to the -mm mm-unstable branch. Its filename is
mm-convert-mm_counter_file-to-take-a-folio.patch
This patch will shortly appear at
https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-convert-mm_counter_file-to-take-a-folio.patch
This patch will later appear in the mm-unstable branch at
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next via the mm-everything
branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there every 2-3 working days
------------------------------------------------------
From: Kefeng Wang <wangkefeng.wang@huawei.com>
Subject: mm: convert mm_counter_file() to take a folio
Date: Thu, 11 Jan 2024 15:24:29 +0000
Now all callers of mm_counter_file() have a folio, convert
mm_counter_file() to take a folio. Saves a call to compound_head() hidden
inside PageSwapBacked().
Link: https://lkml.kernel.org/r/20240111152429.3374566-11-willy@infradead.org
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Cc: David Hildenbrand <david@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
include/linux/mm.h | 8 ++++----
kernel/events/uprobes.c | 2 +-
mm/huge_memory.c | 4 ++--
mm/khugepaged.c | 4 ++--
mm/memory.c | 10 +++++-----
mm/rmap.c | 2 +-
6 files changed, 15 insertions(+), 15 deletions(-)
--- a/include/linux/mm.h~mm-convert-mm_counter_file-to-take-a-folio
+++ a/include/linux/mm.h
@@ -2595,10 +2595,10 @@ static inline void dec_mm_counter(struct
mm_trace_rss_stat(mm, member);
}
-/* Optimized variant when page is already known not to be PageAnon */
-static inline int mm_counter_file(struct page *page)
+/* Optimized variant when folio is already known not to be anon */
+static inline int mm_counter_file(struct folio *folio)
{
- if (PageSwapBacked(page))
+ if (folio_test_swapbacked(folio))
return MM_SHMEMPAGES;
return MM_FILEPAGES;
}
@@ -2607,7 +2607,7 @@ static inline int mm_counter(struct foli
{
if (folio_test_anon(folio))
return MM_ANONPAGES;
- return mm_counter_file(&folio->page);
+ return mm_counter_file(folio);
}
static inline unsigned long get_mm_rss(struct mm_struct *mm)
--- a/kernel/events/uprobes.c~mm-convert-mm_counter_file-to-take-a-folio
+++ a/kernel/events/uprobes.c
@@ -188,7 +188,7 @@ static int __replace_page(struct vm_area
dec_mm_counter(mm, MM_ANONPAGES);
if (!folio_test_anon(old_folio)) {
- dec_mm_counter(mm, mm_counter_file(old_page));
+ dec_mm_counter(mm, mm_counter_file(old_folio));
inc_mm_counter(mm, MM_ANONPAGES);
}
--- a/mm/huge_memory.c~mm-convert-mm_counter_file-to-take-a-folio
+++ a/mm/huge_memory.c
@@ -1921,7 +1921,7 @@ int zap_huge_pmd(struct mmu_gather *tlb,
} else {
if (arch_needs_pgtable_deposit())
zap_deposited_table(tlb->mm, pmd);
- add_mm_counter(tlb->mm, mm_counter_file(&folio->page),
+ add_mm_counter(tlb->mm, mm_counter_file(folio),
-HPAGE_PMD_NR);
}
@@ -2446,7 +2446,7 @@ static void __split_huge_pmd_locked(stru
folio_remove_rmap_pmd(folio, page, vma);
folio_put(folio);
}
- add_mm_counter(mm, mm_counter_file(&folio->page), -HPAGE_PMD_NR);
+ add_mm_counter(mm, mm_counter_file(folio), -HPAGE_PMD_NR);
return;
}
--- a/mm/khugepaged.c~mm-convert-mm_counter_file-to-take-a-folio
+++ a/mm/khugepaged.c
@@ -1634,7 +1634,7 @@ int collapse_pte_mapped_thp(struct mm_st
/* step 3: set proper refcount and mm_counters. */
if (nr_ptes) {
folio_ref_sub(folio, nr_ptes);
- add_mm_counter(mm, mm_counter_file(&folio->page), -nr_ptes);
+ add_mm_counter(mm, mm_counter_file(folio), -nr_ptes);
}
/* step 4: remove empty page table */
@@ -1665,7 +1665,7 @@ abort:
if (nr_ptes) {
flush_tlb_mm(mm);
folio_ref_sub(folio, nr_ptes);
- add_mm_counter(mm, mm_counter_file(&folio->page), -nr_ptes);
+ add_mm_counter(mm, mm_counter_file(folio), -nr_ptes);
}
if (start_pte)
pte_unmap_unlock(start_pte, ptl);
--- a/mm/memory.c~mm-convert-mm_counter_file-to-take-a-folio
+++ a/mm/memory.c
@@ -966,7 +966,7 @@ copy_present_pte(struct vm_area_struct *
} else if (page) {
folio_get(folio);
folio_dup_file_rmap_pte(folio, page);
- rss[mm_counter_file(page)]++;
+ rss[mm_counter_file(folio)]++;
}
/*
@@ -1873,7 +1873,7 @@ static int insert_page_into_pte_locked(s
return -EBUSY;
/* Ok, finally just insert the thing.. */
folio_get(folio);
- inc_mm_counter(vma->vm_mm, mm_counter_file(page));
+ inc_mm_counter(vma->vm_mm, mm_counter_file(folio));
folio_add_file_rmap_pte(folio, page, vma);
set_pte_at(vma->vm_mm, addr, pte, mk_pte(page, prot));
return 0;
@@ -3178,7 +3178,7 @@ static vm_fault_t wp_page_copy(struct vm
if (likely(vmf->pte && pte_same(ptep_get(vmf->pte), vmf->orig_pte))) {
if (old_folio) {
if (!folio_test_anon(old_folio)) {
- dec_mm_counter(mm, mm_counter_file(&old_folio->page));
+ dec_mm_counter(mm, mm_counter_file(old_folio));
inc_mm_counter(mm, MM_ANONPAGES);
}
} else {
@@ -4463,7 +4463,7 @@ vm_fault_t do_set_pmd(struct vm_fault *v
if (write)
entry = maybe_pmd_mkwrite(pmd_mkdirty(entry), vma);
- add_mm_counter(vma->vm_mm, mm_counter_file(page), HPAGE_PMD_NR);
+ add_mm_counter(vma->vm_mm, mm_counter_file(folio), HPAGE_PMD_NR);
folio_add_file_rmap_pmd(folio, page, vma);
/*
@@ -4526,7 +4526,7 @@ void set_pte_range(struct vm_fault *vmf,
folio_add_new_anon_rmap(folio, vma, addr);
folio_add_lru_vma(folio, vma);
} else {
- add_mm_counter(vma->vm_mm, mm_counter_file(page), nr);
+ add_mm_counter(vma->vm_mm, mm_counter_file(folio), nr);
folio_add_file_rmap_ptes(folio, page, nr, vma);
}
set_ptes(vma->vm_mm, addr, vmf->pte, entry, nr);
--- a/mm/rmap.c~mm-convert-mm_counter_file-to-take-a-folio
+++ a/mm/rmap.c
@@ -1903,7 +1903,7 @@ static bool try_to_unmap_one(struct foli
*
* See Documentation/mm/mmu_notifier.rst
*/
- dec_mm_counter(mm, mm_counter_file(&folio->page));
+ dec_mm_counter(mm, mm_counter_file(folio));
}
discard:
if (unlikely(folio_test_hugetlb(folio)))
_
Patches currently in -mm which might be from wangkefeng.wang@huawei.com are
mm-memory-use-nth_page-in-clear-copy_subpage.patch
s390-use-pfn_swap_entry_folio-in-ptep_zap_swap_entry.patch
mm-use-pfn_swap_entry_folio-in-__split_huge_pmd_locked.patch
mm-use-pfn_swap_entry_to_folio-in-zap_huge_pmd.patch
mm-use-pfn_swap_entry_folio-in-copy_nonpresent_pte.patch
mm-convert-to-should_zap_page-to-should_zap_folio.patch
mm-convert-mm_counter-to-take-a-folio.patch
mm-convert-mm_counter_file-to-take-a-folio.patch
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2024-01-11 20:32 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-11 20:32 + mm-convert-mm_counter_file-to-take-a-folio.patch added to mm-unstable branch Andrew Morton
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.