[rfc,00/18] mm: convert to use folio mm counter

Message ID 20231103140119.2306578-1-wangkefeng.wang@huawei.com
Headers
Series mm: convert to use folio mm counter |

Message

Kefeng Wang Nov. 3, 2023, 2:01 p.m. UTC
  Convert mm counter page functions to folio ones.

  mm_counter()       ->	mm_counter_folio()
  mm_counter_file()  ->	mm_counter_file_folio()

Maybe it's better to rename folio mm counter function back to mm_counter()
and mm_counter_file() after all conversion?

Kefeng Wang (18):
  mm: add mm_counter_folio() and mm_counter_file_folio()
  uprobes: use mm_counter_file_folio()
  mm: userfaultfd: use mm_counter_folio()
  mm: rmap: use mm_counter_[file]_folio()
  mm: swap: introduce pfn_swap_entry_to_folio()
  mm: huge_memory: use a folio in __split_huge_pmd_locked()
  mm: huge_memory: use a folio in zap_huge_pmd()
  mm: khugepaged: use mm_counter_file_folio() in
    collapse_pte_mapped_thp()
  mm: memory: use a folio in do_set_pmd()
  mm: memory: use mm_counter_file_folio() in copy_present_pte()
  mm: memory: use mm_counter_file_folio() in wp_page_copy()
  mm: memory: use mm_counter_file_folio() in set_pte_range()
  mm: memory: use a folio in insert_page_into_pte_locked()
  mm: remove mm_counter_file()
  mm: memory: use a folio in copy_nonpresent_pte()
  mm: use a folio in zap_pte_range()
  s390: pgtable: use mm_counter_folio() in ptep_zap_swap_entry()
  mm: remove mm_counter()

 arch/s390/mm/pgtable.c  |  4 +--
 include/linux/mm.h      | 12 +++----
 include/linux/swapops.h | 13 +++++++
 kernel/events/uprobes.c |  2 +-
 mm/huge_memory.c        | 25 +++++++------
 mm/khugepaged.c         |  4 +--
 mm/memory.c             | 77 +++++++++++++++++++++++------------------
 mm/rmap.c               | 10 +++---
 mm/userfaultfd.c        |  4 +--
 9 files changed, 88 insertions(+), 63 deletions(-)
  

Comments

Matthew Wilcox Nov. 3, 2023, 2:30 p.m. UTC | #1
On Fri, Nov 03, 2023 at 10:01:01PM +0800, Kefeng Wang wrote:
> Convert mm counter page functions to folio ones.
> 
>   mm_counter()       ->	mm_counter_folio()
>   mm_counter_file()  ->	mm_counter_file_folio()
> 
> Maybe it's better to rename folio mm counter function back to mm_counter()
> and mm_counter_file() after all conversion?

I deliberately didn't do this because it's mostly churn.
Once all callers of mm_counter() and mm_counter_file() have been
converted to use folios, we can do one big patch to convert all
callers to pass a folio instead of a page.
  
Kefeng Wang Nov. 4, 2023, 3:58 a.m. UTC | #2
On 2023/11/3 22:30, Matthew Wilcox wrote:
> On Fri, Nov 03, 2023 at 10:01:01PM +0800, Kefeng Wang wrote:
>> Convert mm counter page functions to folio ones.
>>
>>    mm_counter()       ->	mm_counter_folio()
>>    mm_counter_file()  ->	mm_counter_file_folio()
>>
>> Maybe it's better to rename folio mm counter function back to mm_counter()
>> and mm_counter_file() after all conversion?
> 
> I deliberately didn't do this because it's mostly churn.
> Once all callers of mm_counter() and mm_counter_file() have been
> converted to use folios, we can do one big patch to convert all
> callers to pass a folio instead of a page.
> 
I re-order the patches as you say, please help to check v2, thanks.