mm: make swapin readahead to gain more thp performance
Subsystems (4)
v4 cover mm: make swapin readahead to gain more thp performance
This patch series makes swapin readahead up to a certain number to gain more thp performance and adds tracepoint for khugepaged_scan_pmd, collapse_huge_page, __collapse_huge_page_isolate.
This patch series was written to deal with programs that access most, but not all, of their memory after they get swapped out. Currently these programs do not get their memory collapsed into THPs after the system swapped their memory out, while they would get THPs before swapping happened.
This patch series was tested with a test program, it allocates 800MB of memory, writes to it, and then sleeps. I force the system to swap out all. Afterwards, the test program touches the area by writing and leaves a piece of it without writing. This shows how much swap in readahead made by the patch.
Test results:
After swapped out
-------------------------------------------------------------------
| Anonymous | AnonHugePages | Swap | Fraction |
-------------------------------------------------------------------
With patch | 253720 kB | 251904 kB | 546284 kB | %99 |
-------------------------------------------------------------------
Without patch | 238160 kB | 235520 kB | 561844 kB | %98 |
-------------------------------------------------------------------
After swapped in
-------------------------------------------------------------------
| Anonymous | AnonHugePages | Swap | Fraction |
-------------------------------------------------------------------
With patch | 533532 kB | 528384 kB | 266472 kB | %90 |
-------------------------------------------------------------------
Without patch | 499956 kB | 235520 kB | 300048 kB | %47 |
-------------------------------------------------------------------
Ebru Akagunduz (3):
mm: add tracepoint for scanning pages
mm: make optimistic check for swapin readahead
mm: make swapin readahead to improve thp collapse rate
include/linux/mm.h | 4 + include/trace/events/huge_memory.h | 126 +++++++++++++++++ mm/huge_memory.c | 272 ++++++++++++++++++++++++++++++++----- mm/memory.c | 2 +- 4 files changed, 371 insertions(+), 33 deletions(-) create mode 100644 include/trace/events/huge_memory.h
Signature · 7 lines
1.9.1 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
RFC v4 1/3 mm: add tracepoint for scanning pages
Using static tracepoints, data of functions is recorded. It is good to automatize debugging without doing a lot of changes in the source code.
This patch adds tracepoint for khugepaged_scan_pmd, collapse_huge_page and __collapse_huge_page_isolate.
---
Changes in v2:
- Nothing changed
Changes in v3:
- Print page address instead of vm_start (Vlastimil Babka)
- Define constants to specify exact tracepoint result (Vlastimil Babka)
Changes in v4:
- Change the constant prefix with SCAN_ instead of MM_ (Vlastimil Babka)
- Move the constants into the enum (Vlastimil Babka)
- Move the constants from mm.h to huge_memory.c
(because only will be used in huge_memory.c) (Vlastimil Babka)
- Print pfn in tracepoints (Vlastimil Babka)
- Print scan result as string in tracepoint (Vlastimil Babka) (I tried to make same things to print string like mm/compaction.c. My patch does not print string, I skip something but could not see why)
- Do not change function return values for success and failure, leave them original agreed with Doc/CodingStyle (Vlastimil Babka)
- Define scan_result to specify tracepoint result (Ebru Akagunduz)
- Add out_nolock label to avoid multiple tracepoints (Vlastimil Babka)
include/trace/events/huge_memory.h | 100 ++++++++++++++++++++ mm/huge_memory.c | 187 +++++++++++++++++++++++++++++++------ 2 files changed, 256 insertions(+), 31 deletions(-) create mode 100644 include/trace/events/huge_memory.h
include/trace/events/huge_memory.h new file +100 -0
@@ -0,0 +1,100 @@ +#undef TRACE_SYSTEM +#define TRACE_SYSTEM huge_memory + +#if !defined(__HUGE_MEMORY_H) || defined(TRACE_HEADER_MULTI_READ ) +#define __HUGE_MEMORY_H + +#include <linux/tracepoint.h> + +TRACE_EVENT (mm_khugepaged_scan_pmd, + + TP_PROTO(struct mm_struct *mm, unsigned long pfn, bool writable, + bool referenced, int none_or_zero, int status), + +TP_ARGS (mm, pfn, writable, referenced, none_or_zero, status), + +TP_STRUCT__entry ( + __field(struct mm_struct *, mm) + __field(unsigned long, pfn) + __field(bool, writable) + __field(bool, referenced) + __field(int, none_or_zero) +__field (int, status) + ), + +TP_fast_assign ( + __entry->mm = mm; + __entry->pfn = pfn; + __entry->writable = writable; + __entry->referenced = referenced; + __entry->none_or_zero = none_or_zero; + __entry->status = status; + ), + +TP_printk ("mm=%p, scan_pfn=0x%lx, writable=%d, referenced=%d, none_or_zero=%d, status=%s" , + __entry->mm, + __entry->pfn, + __entry->writable, + __entry->referenced, + __entry->none_or_zero, + khugepaged_status_string[__entry->status]) +); + +TRACE_EVENT (mm_collapse_huge_page, + + TP_PROTO(struct mm_struct *mm, int isolated, int status), + +TP_ARGS (mm, isolated, status), + +TP_STRUCT__entry ( + __field(struct mm_struct *, mm) + __field(int, isolated) +__field (int, status) + ), + +TP_fast_assign ( + __entry->mm = mm; + __entry->isolated = isolated; + __entry->status = status; + ), + +TP_printk ("mm=%p, isolated=%d, status=%s" , + __entry->mm, + __entry->isolated, + khugepaged_status_string[__entry->status]) +); + +TRACE_EVENT (mm_collapse_huge_page_isolate, + + TP_PROTO(unsigned long pfn, int none_or_zero, + bool referenced, bool writable, int status), + +TP_ARGS (pfn, none_or_zero, referenced, writable, status), + +TP_STRUCT__entry ( + __field(unsigned long, pfn) + __field(int, none_or_zero) + __field(bool, referenced) + __field(bool, writable) +__field (int, status) + ), + +TP_fast_assign ( + __entry->pfn = pfn; + __entry->none_or_zero = none_or_zero; + __entry->referenced = referenced; + __entry->writable = writable; + __entry->status = status; + ), + +TP_printk ("scan_pfn=0x%lx, none_or_zero=%d, referenced=%d, writable=%d, status=%s" , + __entry->pfn, + __entry->none_or_zero, + __entry->referenced, + __entry->writable, + khugepaged_status_string[__entry->status]) +); + +#endif /* __HUGE_MEMORY_H */ +#include <trace/define_trace.h> +
mm/huge_memory.c +156 -31
344 lines not on this page · raw message
Signature · 7 lines
1.9.1 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
RFC v4 2/3 mm: make optimistic check for swapin readahead
In reply to Ebru AkagunduzThis patch introduces new sysfs integer knob /sys/kernel/mm/transparent_hugepage/khugepaged/max_ptes_swap which makes optimistic check for swapin readahead to increase thp collapse rate. Before getting swapped out pages to memory, checks them and allows up to a certain number. It also prints out using tracepoints amount of unmapped ptes.
---
Changes in v2:
- Nothing changed
Changes in v3:
- Define constant for exact tracepoint result (Vlastimil Babka)
Changes in v4:
- Add sysfs knob request (Kirill A. Shutemov)
include/trace/events/huge_memory.h | 10 ++++---- mm/huge_memory.c | 48 ++++++++++++++++++++++++++++++++++---- 2 files changed, 50 insertions(+), 8 deletions(-)
include/trace/events/huge_memory.h +6 -4
@@ -9,9 +9,9 @@ TRACE_EVENT(mm_khugepaged_scan_pmd, TP_PROTO(struct mm_struct *mm, unsigned long pfn, bool writable, - bool referenced, int none_or_zero, int status), + bool referenced, int none_or_zero, int status, int unmapped), - TP_ARGS(mm, pfn, writable, referenced, none_or_zero, status), + TP_ARGS(mm, pfn, writable, referenced, none_or_zero, status, unmapped), TP_STRUCT__entry( __field(struct mm_struct *, mm)
@@ -20,6 +20,7 @@ TRACE_EVENT(mm_khugepaged_scan_pmd, __field(bool, referenced) __field(int, none_or_zero) __field(int, status) +__field (int, unmapped) ), TP_fast_assign(
@@ -31,13 +32,14 @@ TRACE_EVENT(mm_khugepaged_scan_pmd, __entry->status = status; ), -TP_printk ("mm=%p, scan_pfn=0x%lx, writable=%d, referenced=%d, none_or_zero=%d, status=%s" , +TP_printk ("mm=%p, scan_pfn=0x%lx, writable=%d, referenced=%d, none_or_zero=%d, status=%s, unmapped=%d" , __entry->mm, __entry->pfn, __entry->writable, __entry->referenced, __entry->none_or_zero, - khugepaged_status_string[__entry->status]) + khugepaged_status_string[__entry->status], + __entry->unmapped) ); TRACE_EVENT(mm_collapse_huge_page,
mm/huge_memory.c +44 -4
102 lines not on this page · raw message
Signature · 7 lines
1.9.1 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
RFC v4 3/3 mm: make swapin readahead to improve thp collapse rate
In reply to Ebru AkagunduzThis patch makes swapin readahead to improve thp collapse rate. When khugepaged scanned pages, there can be a few of the pages in swap area.
With the patch THP can collapse 4kB pages into a THP when there are up to max_ptes_swap swap ptes in a 2MB range.
The patch was tested with a test program that allocates 800MB of memory, writes to it, and then sleeps. I force the system to swap out all. Afterwards, the test program touches the area by writing, it skips a page in each 20 pages of the area.
Without the patch, system did not swap in readahead. THP rate was %47 of the program of the memory, it did not change over time.
With this patch, after 10 minutes of waiting khugepaged had collapsed %90 of the program's memory.
---
Changes in v2:
- Use FAULT_FLAG_ALLOW_RETRY|FAULT_FLAG_RETRY_NOWAIT flag instead of 0x0 when called do_swap_page from __collapse_huge_page_swapin (Rik van Riel)
Changes in v3:
- Catch VM_FAULT_HWPOISON and VM_FAULT_OOM return cases in __collapse_huge_page_swapin (Kirill A. Shutemov)
Changes in v4:
- Fix broken indentation reverting if (...) statement in __collapse_huge_page_swapin (Kirill A. Shutemov)
- Fix check statement of ret (Kirill A. Shutemov)
- Use swapped_in name instead of swap_pte
After swapped out
-------------------------------------------------------------------
| Anonymous | AnonHugePages | Swap | Fraction |
-------------------------------------------------------------------
With patch | 253720 kB | 251904 kB | 546284 kB | %99 |
-------------------------------------------------------------------
Without patch | 238160 kB | 235520 kB | 561844 kB | %98 |
-------------------------------------------------------------------
After swapped in
-------------------------------------------------------------------
| Anonymous | AnonHugePages | Swap | Fraction |
-------------------------------------------------------------------
With patch | 533532 kB | 528384 kB | 266472 kB | %90 |
-------------------------------------------------------------------
Without patch | 499956 kB | 235520 kB | 300048 kB | %47 |
-------------------------------------------------------------------
include/linux/mm.h | 4 ++++ include/trace/events/huge_memory.h | 24 +++++++++++++++++++++ mm/huge_memory.c | 43 ++++++++++++++++++++++++++++++++++++++ mm/memory.c | 2 +- 4 files changed, 72 insertions(+), 1 deletion(-)
include/linux/mm.h +4 -0
@@ -29,6 +29,10 @@ struct user_struct;struct writeback_control ;struct bdi_writeback ; +extern int do_swap_page (struct mm_struct *mm,struct vm_area_struct *vma, +unsigned long address,pte_t *page_table,pmd_t *pmd, +unsigned int flags,pte_t orig_pte); +#ifndef CONFIG_NEED_MULTIPLE_NODES /* Don't use mapnrs, do it properly */ extern unsigned long max_mapnr;
include/trace/events/huge_memory.h +24 -0
@@ -97,6 +97,30 @@ TRACE_EVENT(mm_collapse_huge_page_isolate, khugepaged_status_string[__entry->status]) ); +TRACE_EVENT (mm_collapse_huge_page_swapin, + + TP_PROTO(struct mm_struct *mm, int swapped_in, int ret), + +TP_ARGS (mm, swapped_in, ret), + +TP_STRUCT__entry ( + __field(struct mm_struct *, mm) + __field(int, swapped_in) +__field (int, ret) + ), + +TP_fast_assign ( + __entry->mm = mm; + __entry->swapped_in = swapped_in; + __entry->ret = ret; + ), + +TP_printk ("mm=%p, swapped_in=%d, ret=%d" , + __entry->mm, + __entry->swapped_in, + __entry->ret) +); +#endif /* __HUGE_MEMORY_H */ #include <trace/define_trace.h>
mm/huge_memory.c +43 -0
55 lines not on this page · raw message
mm/memory.c +1 -1
@@ -2442,7 +2442,7 @@ EXPORT_SYMBOL(unmap_mapping_range);* We return with the mmap_sem locked or unlocked in the same cases * as does filemap_fault(). */ -static int do_swap_page (struct mm_struct *mm,struct vm_area_struct *vma, +int do_swap_page (struct mm_struct *mm,struct vm_area_struct *vma,unsigned long address,pte_t *page_table,pmd_t *pmd,unsigned int flags,pte_t orig_pte) {
Signature · 7 lines
1.9.1 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Re: [RESEND RFC v4 1/3] mm: add tracepoint for scanning pages
In reply to Ebru AkagunduzQuoted 18 lines · Ebru Akagunduz
Using static tracepoints, data of functions is recorded. It is good to automatize debugging without doing a lot of changes in the source code.
This patch adds tracepoint for
khugepaged_scan_pmd,collapse_huge_pageand__collapse_huge_page_isolate.Signed-off-by Ebru Akagunduz <[email protected]>Acked-by Rik van Riel <[email protected]>---
Changes in v2:
- Nothing changedChanges in v3:
- Print page address instead ofvm_start(Vlastimil Babka)
- Define constants to specify exact tracepoint result (Vlastimil Babka)
Quoted 9 lines
Changes in v4:
- Change the constant prefix withSCAN_instead ofMM_(Vlastimil Babka)
- Move the constants into the enum (Vlastimil Babka)
- Move the constants frommm.htohuge_memory.c
(because only will be used inhuge_memory.c) (Vlastimil Babka)
- Print pfn in tracepoints (Vlastimil Babka)
- Print scan result as string in tracepoint (Vlastimil Babka) (I tried to make same things to print string likemm/compaction.c. My patch does not print string, I skip something but could not see why)
How do you print the trace? Do you cat /sys/kernel/debug/tracing/trace_pipe or use some tool such as trace-cmd? I have just recently realized that tools don't print strings in the compaction tracepoints, which lead to a patch [1]. You could convert this patch in the same way and then it should work with tracing tools. Sorry for previously suggesting a wrong example to follow.
[1] https://lkml.org/lkml/2015/8/27/373
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Re: [RESEND RFC v4 2/3] mm: make optimistic check for swapin readahead
In reply to Ebru AkagunduzQuoted 9 lines · Ebru Akagunduz
This patch introduces new sysfs integer knob
/sys/kernel/mm/transparent_hugepage/khugepaged/max_ptes_swapwhich makes optimistic check for swapin readahead to increase thp collapse rate. Before getting swapped out pages to memory, checks them and allows up to a certain number. It also prints out using tracepoints amount of unmapped ptes.Signed-off-by Ebru Akagunduz <[email protected]>
...
Quoted 12 lines
#include <
asm/pgalloc.h>mm/huge_memory.c +2
-1@@ -49,7 +50,8 @@ static const char *const khugepaged_status_string[] = {"page_swap_cache" ,"could_not_delete_page_from_lru" ,"alloc_huge_page_fail" , -"ccgroup_charge_fail" +"ccgroup_charge_fail" , +"exceed_swap_pte" }; enum scan_result {
mm/huge_memory.c enum scan_result { · line 79
Quoted 6 lines
mm/huge_memory.c +2
-1@@ -73,7 +75,8 @@ enum scan_result {SCAN_SWAP_CACHE_PAGE ,SCAN_DEL_PAGE_LRU ,SCAN_ALLOC_HUGE_PAGE_FAIL , -SCAN_CGROUP_CHARGE_FAIL +SCAN_CGROUP_CHARGE_FAIL , +MM_EXCEED_SWAP_PTE
This one should be renamed too.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Re: [RESEND RFC v4 3/3] mm: make swapin readahead to improve thp collapse rate
In reply to Ebru AkagunduzQuoted 68 lines · Ebru Akagunduz
This patch makes swapin readahead to improve thp collapse rate. When khugepaged scanned pages, there can be a few of the pages in swap area.
With the patch THP can collapse 4kB pages into a THP when there are up to
max_ptes_swapswap ptes in a 2MB range.The patch was tested with a test program that allocates 800MB of memory, writes to it, and then sleeps. I force the system to swap out all. Afterwards, the test program touches the area by writing, it skips a page in each 20 pages of the area.
Without the patch, system did not swap in readahead. THP rate was %47 of the program of the memory, it did not change over time.
With this patch, after 10 minutes of waiting khugepaged had collapsed %90 of the program's memory.
Signed-off-by Ebru Akagunduz <[email protected]>Acked-by Rik van Riel <[email protected]>---
Changes in v2:
- Use FAULT_FLAG_ALLOW_RETRY|FAULT_FLAG_RETRY_NOWAIT flag instead of0x0when calleddo_swap_pagefrom__collapse_huge_page_swapin(Rik van Riel)Changes in v3:
- CatchVM_FAULT_HWPOISONandVM_FAULT_OOMreturn cases in__collapse_huge_page_swapin(Kirill A. Shutemov)Changes in v4:
- Fix broken indentation reverting if (...) statement in__collapse_huge_page_swapin(Kirill A. Shutemov)
- Fix check statement of ret (Kirill A. Shutemov)
- Useswapped_inname instead ofswap_pteAfter swapped out
-------------------------------------------------------------------
| Anonymous | AnonHugePages | Swap | Fraction |
-------------------------------------------------------------------
With patch | 253720 kB | 251904 kB | 546284 kB | %99 |
-------------------------------------------------------------------
Without patch | 238160 kB | 235520 kB | 561844 kB | %98 |
-------------------------------------------------------------------After swapped in
-------------------------------------------------------------------
| Anonymous | AnonHugePages | Swap | Fraction |
-------------------------------------------------------------------
With patch | 533532 kB | 528384 kB | 266472 kB | %90 |
-------------------------------------------------------------------
Without patch | 499956 kB | 235520 kB | 300048 kB | %47 |
-------------------------------------------------------------------include/linux/mm.h | 4 ++++ include/trace/events/huge_memory.h | 24 +++++++++++++++++++++ mm/huge_memory.c | 43 ++++++++++++++++++++++++++++++++++++++ mm/memory.c | 2 +- 4 files changed, 72 insertions(+), 1 deletion(-)include/linux/mm.h +0
-0
include/linux/mm.h struct user_struct; · line 35
Quoted 7 lines
include/linux/mm.h +4
-0@@ -29,6 +29,10 @@ struct user_struct;struct writeback_control ;struct bdi_writeback ; +extern int do_swap_page (struct mm_struct *mm,struct vm_area_struct *vma, +unsigned long address,pte_t *page_table,pmd_t *pmd, +unsigned int flags,pte_t orig_pte); +
I'd rather use mm/internal.h here than export the function outside mm.
Quoted 91 lines
include/linux/mm.h +0
-0#ifndef CONFIG_NEED_MULTIPLE_NODES /* Don't use mapnrs, do it properly */ extern unsigned long max_mapnr;include/trace/events/huge_memory.h +24
-0@@ -97,6 +97,30 @@ TRACE_EVENT(mm_collapse_huge_page_isolate, khugepaged_status_string[__entry->status]) ); +TRACE_EVENT (mm_collapse_huge_page_swapin, + + TP_PROTO(struct mm_struct *mm, int swapped_in, int ret), + +TP_ARGS (mm, swapped_in, ret), + +TP_STRUCT__entry ( + __field(struct mm_struct *, mm) + __field(int, swapped_in) +__field (int, ret) + ), + +TP_fast_assign ( + __entry->mm = mm; + __entry->swapped_in = swapped_in; + __entry->ret = ret; + ), + +TP_printk ("mm=%p, swapped_in=%d, ret=%d" , + __entry->mm, + __entry->swapped_in, + __entry->ret) +); +#endif /* __HUGE_MEMORY_H */ #include <trace/define_trace.h> mm/huge_memory.c +41
-0@@ -2529,6 +2529,47 @@ static bool hugepage_vma_check(struct vm_area_struct *vma)return true; } +/* +* Bring missing pages in from swap, to complete THP collapse. +* Only done if khugepaged_scan_pmd believes it is worthwhile. +* +* Called and returns without pte mapped or spinlocks held, +* but with mmap_sem held to protect against vma changes. +*/ + +static void __collapse_huge_page_swapin (struct mm_struct *mm, +struct vm_area_struct *vma, +unsigned long address,pmd_t *pmd, +pte_t *pte) +{ +unsigned long _address; +pte_t pteval = *pte; +int swapped_in =0 , ret =0 ; + + pte =pte_offset_map (pmd, address); +for (_address = address; _address < address +HPAGE_PMD_NR *PAGE_SIZE ; + pte++, _address +=PAGE_SIZE ) { + pteval = *pte; +if (!is_swap_pte (pteval)) +continue ; + swapped_in++; + ret =do_swap_page (mm, vma, _address, pte, pmd, +FAULT_FLAG_ALLOW_RETRY |FAULT_FLAG_RETRY_NOWAIT , + pteval); +if (ret &VM_FAULT_ERROR ) { +trace_mm_collapse_huge_page_swapin (mm, swapped_in,0 ); +return ; + } +/* pte is unmapped now, we need to map it */ + pte =pte_offset_map (pmd, _address); + } + pte--; +pte_unmap (pte); +trace_mm_collapse_huge_page_swapin (mm, swapped_in,1 ); +} + + + static void collapse_huge_page(struct mm_struct *mm, unsigned long address, struct page **hpage,
mm/huge_memory.c static void collapse_huge_page(struct mm_struct *mm, · line 2644
Quoted 4 lines
mm/huge_memory.c +1
-0@@ -2600,6 +2641,8 @@ static void collapse_huge_page(struct mm_struct *mm,anon_vma_lock_write (vma->anon_vma); +__collapse_huge_page_swapin (mm, vma, address, pmd, pte);
Hmm it seems rather wasteful to call this when no swap entries were detected. Also it seems pointless to try continue collapsing when we have just only issued async swap-in? What are the chances they would finish in time?
I'm less sure about the relation vs khugepaged_alloc_page(). At this point, we have already succeeded the hugepage allocation. It makes sense not to swap-in if we can't allocate a hugepage. It makes also sense not to allocate a hugepage if we will just issue async swap-ins and then free the hugepage back. Swap-in means disk I/O that's best avoided if not useful. But the reclaim for hugepage allocation might also involve disk I/O. At worst, it could be creating new swap pte's in the very pmd we are scanning... Thoughts?
Quoted 10 lines
mm/huge_memory.c +1
-0+ pte =pte_offset_map (pmd, address); pte_ptl =pte_lockptr (mm, pmd);mm/memory.c +0
-0
mm/memory.c EXPORT_SYMBOL(unmap_mapping_range); · line 2448
Quoted 8 lines
mm/memory.c +1
-1@@ -2442,7 +2442,7 @@ EXPORT_SYMBOL(unmap_mapping_range);* We return with the mmap_sem locked or unlocked in the same cases * as does filemap_fault(). */ -static int do_swap_page (struct mm_struct *mm,struct vm_area_struct *vma, +int do_swap_page (struct mm_struct *mm,struct vm_area_struct *vma,unsigned long address,pte_t *page_table,pmd_t *pmd,unsigned int flags,pte_t orig_pte) {
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Re: [RESEND RFC v4 1/3] mm: add tracepoint for scanning pages
In reply to Vlastimil BabkaQuoted 29 lines · Vlastimil Babka
Quoted 18 lines · Ebru Akagunduz
Using static tracepoints, data of functions is recorded. It is good to automatize debugging without doing a lot of changes in the source code.
This patch adds tracepoint for
khugepaged_scan_pmd,collapse_huge_pageand__collapse_huge_page_isolate.Signed-off-by Ebru Akagunduz <[email protected]>Acked-by Rik van Riel <[email protected]>---
Changes in v2:
- Nothing changedChanges in v3:
- Print page address instead ofvm_start(Vlastimil Babka)
- Define constants to specify exact tracepoint result (Vlastimil Babka)Quoted 9 lines
Changes in v4:
- Change the constant prefix withSCAN_instead ofMM_(Vlastimil Babka)
- Move the constants into the enum (Vlastimil Babka)
- Move the constants frommm.htohuge_memory.c
(because only will be used inhuge_memory.c) (Vlastimil Babka)
- Print pfn in tracepoints (Vlastimil Babka)
- Print scan result as string in tracepoint (Vlastimil Babka) (I tried to make same things to print string likemm/compaction.c. My patch does not print string, I skip something but could not see why)
Quoted 7 lines
How do you print the trace? Do you cat
/sys/kernel/debug/tracing/trace_pipeor use some tool such as trace-cmd? I have just recently realized that tools don't print strings in the compaction tracepoints, which lead to a patch [1]. You could convert this patch in the same way and then it should work with tracing tools. Sorry for previously suggesting a wrong example to follow.
Well that explains why doing the same thing as compaction.c resulted in the strings not being printed! Ebru and I got confused over that for quite a while :)
Thanks for pointing us to the fix.
Ebru, can you use tracepoint macros like in Vlastimil's patch above, so your tracepoints work?
Signature · 7 lines
All rights reversed -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Re: [RESEND RFC v4 1/3] mm: add tracepoint for scanning pages
Quoted 30 lines · Rik van Riel
Quoted 29 lines · Vlastimil Babka
Quoted 27 lines · Ebru Akagunduz
Using static tracepoints, data of functions is recorded. It is good to automatize debugging without doing a lot of changes in the source code.
This patch adds tracepoint for
khugepaged_scan_pmd,collapse_huge_pageand__collapse_huge_page_isolate.Signed-off-by Ebru Akagunduz <[email protected]>Acked-by Rik van Riel <[email protected]>---
Changes in v2:
- Nothing changedChanges in v3:
- Print page address instead ofvm_start(Vlastimil Babka)
- Define constants to specify exact tracepoint result (Vlastimil Babka)Changes in v4:
- Change the constant prefix withSCAN_instead ofMM_(Vlastimil Babka)
- Move the constants into the enum (Vlastimil Babka)
- Move the constants frommm.htohuge_memory.c
(because only will be used inhuge_memory.c) (Vlastimil Babka)
- Print pfn in tracepoints (Vlastimil Babka)
- Print scan result as string in tracepoint (Vlastimil Babka) (I tried to make same things to print string likemm/compaction.c. My patch does not print string, I skip something but could not see why)
Quoted 7 lines
Quoted 7 lines
How do you print the trace? Do you cat
/sys/kernel/debug/tracing/trace_pipeor use some tool such as trace-cmd? I have just recently realized that tools don't print strings in the compaction tracepoints, which lead to a patch [1]. You could convert this patch in the same way and then it should work with tracing tools. Sorry for previously suggesting a wrong example to follow.
I use perf tool to test changes.
Quoted 10 lines
Well that explains why doing the same thing as
compaction.cresulted in the strings not being printed! Ebru and I got confused over that for quite a while :)Thanks for pointing us to the fix.
Ebru, can you use tracepoint macros like in Vlastimil's patch above, so your tracepoints work?
I did similar changes with Vlastimil's patch. It works!
Thanks,
Ebru
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>