Re: [PATCH v2 3/7] mm/khugepaged: introduce a count_collapse_event() helper
Nico Pache <[email protected]> Mon, 3 Aug 2026 13:13:32 -0600
| Newsgroups | org.kvack.linux-mm,org.kernel.vger.linux-doc,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <CAA1CXcCofU8t_um5K0GWZY8_qOM7VC1tmw5B=Q56fGTAZHZ58A@mail.gmail.com> |
On Wed, Jul 29, 2026 at 3:43=E2=80=AFAM David Hildenbrand (Arm) <[email protected]> wrote: > > On 7/15/26 04:59, Nico Pache wrote: > > Provide a simple helper function to help reduce a often used, and > > duplicate pattern across the khugepaged code. > > > > When collapsing to a PMD we need to record a vm_event and the mTHP_stat > > event. When doing mTHP collapse we only update the mTHP stat. > > > > Reviewed-by: Baolin Wang <[email protected]> > > Acked-by: Usama Arif <[email protected]> > > Signed-off-by: Nico Pache <[email protected]> > > --- > > mm/khugepaged.c | 36 ++++++++++++++++++------------------ > > 1 file changed, 18 insertions(+), 18 deletions(-) > > > > diff --git a/mm/khugepaged.c b/mm/khugepaged.c > > index e92e2b928f17..f65bbe2051b3 100644 > > --- a/mm/khugepaged.c > > +++ b/mm/khugepaged.c > > @@ -689,6 +689,14 @@ static inline bool collapse_is_referenced(struct c= ollapse_control *cc, pte_t pte > > mmu_notifier_test_young(vma->vm_mm, addr)); > > } > > > > +static void count_collapse_event(unsigned int order, enum vm_event_ite= m vm_event, > > + enum mthp_stat_item mthp_event) > > +{ > > + if (is_pmd_order(order)) > > + count_vm_event(vm_event); > > + count_mthp_stat(order, mthp_event); > > +} > > + > > static enum scan_result __collapse_huge_page_isolate(struct vm_area_st= ruct *vma, > > unsigned long start_addr, pte_t *pte, struct collapse_con= trol *cc, > > unsigned int order, struct list_head *compound_pagelist) > > @@ -709,9 +717,8 @@ static enum scan_result __collapse_huge_page_isolat= e(struct vm_area_struct *vma, > > if (pte_none_or_zero(pteval)) { > > if (++none_or_zero > max_ptes_none) { > > result =3D SCAN_EXCEED_NONE_PTE; > > - if (is_pmd_order(order)) > > - count_vm_event(THP_SCAN_EXCEED_NO= NE_PTE); > > - count_mthp_stat(order, MTHP_STAT_COLLAPSE= _EXCEED_NONE); > > + count_collapse_event(order, THP_SCAN_EXCE= ED_NONE_PTE, > > + MTHP_STAT_COLLAPSE_EXCEED= _NONE); > > That's not how we indent parameters here. Unless my mail client displays = it in a > weird way (doubt). > > Same applies to all other cases. > > Apart from that LGTM. Ok sounds good I'll get those fixed and send a new version soon. > > -- > Cheers, > > David >