Patch "mm: khugepaged: fix the arguments order in khugepaged_collapse_file trace point" has been added to the 6.6-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    mm: khugepaged: fix the arguments order in khugepaged_collapse_file trace point

to the 6.6-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     mm-khugepaged-fix-the-arguments-order-in-khugepaged_.patch
and it can be found in the queue-6.6 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 777dadbb80b9caed50e442d28afd2c31e2e33ac8
Author: Yang Shi <yang@xxxxxxxxxxxxxxxxxxxxxx>
Date:   Fri Oct 11 18:17:02 2024 -0700

    mm: khugepaged: fix the arguments order in khugepaged_collapse_file trace point
    
    [ Upstream commit 37f0b47c5143c2957909ced44fc09ffb118c99f7 ]
    
    The "addr" and "is_shmem" arguments have different order in TP_PROTO and
    TP_ARGS.  This resulted in the incorrect trace result:
    
    text-hugepage-644429 [276] 392092.878683: mm_khugepaged_collapse_file:
    mm=0xffff20025d52c440, hpage_pfn=0x200678c00, index=512, addr=1, is_shmem=0,
    filename=text-hugepage, nr=512, result=failed
    
    The value of "addr" is wrong because it was treated as bool value, the
    type of is_shmem.
    
    Fix the order in TP_PROTO to keep "addr" is before "is_shmem" since the
    original patch review suggested this order to achieve best packing.
    
    And use "lx" for "addr" instead of "ld" in TP_printk because address is
    typically shown in hex.
    
    After the fix, the trace result looks correct:
    
    text-hugepage-7291  [004]   128.627251: mm_khugepaged_collapse_file:
    mm=0xffff0001328f9500, hpage_pfn=0x20016ea00, index=512, addr=0x400000,
    is_shmem=0, filename=text-hugepage, nr=512, result=failed
    
    Link: https://lkml.kernel.org/r/20241012011702.1084846-1-yang@xxxxxxxxxxxxxxxxxxxxxx
    Fixes: 4c9473e87e75 ("mm/khugepaged: add tracepoint to collapse_file()")
    Signed-off-by: Yang Shi <yang@xxxxxxxxxxxxxxxxxxxxxx>
    Cc: Gautam Menghani <gautammenghani201@xxxxxxxxx>
    Cc: Steven Rostedt (Google) <rostedt@xxxxxxxxxxx>
    Cc: <stable@xxxxxxxxxxxxxxx>    [6.2+]
    Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/include/trace/events/huge_memory.h b/include/trace/events/huge_memory.h
index dc6eeef2d3dac..37f2443b3cdb0 100644
--- a/include/trace/events/huge_memory.h
+++ b/include/trace/events/huge_memory.h
@@ -208,7 +208,7 @@ TRACE_EVENT(mm_khugepaged_scan_file,
 
 TRACE_EVENT(mm_khugepaged_collapse_file,
 	TP_PROTO(struct mm_struct *mm, struct folio *new_folio, pgoff_t index,
-			bool is_shmem, unsigned long addr, struct file *file,
+			unsigned long addr, bool is_shmem, struct file *file,
 			int nr, int result),
 	TP_ARGS(mm, new_folio, index, addr, is_shmem, file, nr, result),
 	TP_STRUCT__entry(
@@ -233,7 +233,7 @@ TRACE_EVENT(mm_khugepaged_collapse_file,
 		__entry->result = result;
 	),
 
-	TP_printk("mm=%p, hpage_pfn=0x%lx, index=%ld, addr=%ld, is_shmem=%d, filename=%s, nr=%d, result=%s",
+	TP_printk("mm=%p, hpage_pfn=0x%lx, index=%ld, addr=%lx, is_shmem=%d, filename=%s, nr=%d, result=%s",
 		__entry->mm,
 		__entry->hpfn,
 		__entry->index,
diff --git a/mm/khugepaged.c b/mm/khugepaged.c
index 4b00592548f59..a87cfe1d4b7be 100644
--- a/mm/khugepaged.c
+++ b/mm/khugepaged.c
@@ -2203,7 +2203,7 @@ static int collapse_file(struct mm_struct *mm, unsigned long addr,
 	folio_put(new_folio);
 out:
 	VM_BUG_ON(!list_empty(&pagelist));
-	trace_mm_khugepaged_collapse_file(mm, new_folio, index, is_shmem, addr, file, HPAGE_PMD_NR, result);
+	trace_mm_khugepaged_collapse_file(mm, new_folio, index, addr, is_shmem, file, HPAGE_PMD_NR, result);
 	return result;
 }
 




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux