Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1218572 > unrolled thread

[RESEND RFC v4 1/3] mm: add tracepoint for scanning pages

Started byEbru Akagunduz <ebru.akagunduz@gmail.com>
First post2015-09-03 23:00 +0200
Last post2015-09-05 21:30 +0200
Articles 4 — 3 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [RESEND RFC v4 1/3] mm: add tracepoint for scanning pages Ebru Akagunduz <ebru.akagunduz@gmail.com> - 2015-09-03 23:00 +0200
    Re: [RESEND RFC v4 1/3] mm: add tracepoint for scanning pages Vlastimil Babka <vbabka@suse.cz> - 2015-09-04 18:10 +0200
      Re: [RESEND RFC v4 1/3] mm: add tracepoint for scanning pages Rik van Riel <riel@redhat.com> - 2015-09-04 18:50 +0200
        Re: [RESEND RFC v4 1/3] mm: add tracepoint for scanning pages Ebru Akagunduz <ebru.akagunduz@gmail.com> - 2015-09-05 21:30 +0200

#1218572 — [RESEND RFC v4 1/3] mm: add tracepoint for scanning pages

FromEbru Akagunduz <ebru.akagunduz@gmail.com>
Date2015-09-03 23:00 +0200
Subject[RESEND RFC v4 1/3] mm: add tracepoint for scanning pages
Message-ID<q4JM0-6kV-35@gated-at.bofh.it>
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.

Signed-off-by: Ebru Akagunduz <ebru.akagunduz@gmail.com>
Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Acked-by: Rik van Riel <riel@redhat.com>
---
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

diff --git a/include/trace/events/huge_memory.h b/include/trace/events/huge_memory.h
new file mode 100644
index 0000000..36162a9
--- /dev/null
+++ b/include/trace/events/huge_memory.h
@@ -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>
+
diff --git a/mm/huge_memory.c b/mm/huge_memory.c
index 097c7a4..71a7c43 100644
--- a/mm/huge_memory.c
+++ b/mm/huge_memory.c
@@ -28,6 +28,57 @@
 #include <asm/pgalloc.h>
 #include "internal.h"
 
+static const char *const khugepaged_status_string[] = {
+	"failed",
+	"succeeded",
+	"pmd_null",
+	"exceeded_none_pte",
+	"non-present_pte",
+	"no_writable_page",
+	"no_referenced_page",
+	"page_null",
+	"scan_aborted",
+	"not_suitable_page_count",
+	"page_not_in_lru",
+	"page_locked",
+	"page_not_anon",
+	"no_process_for_page",
+	"vma_null",
+	"vma_check_fail",
+	"not_suitable_address_range",
+	"page_swap_cache",
+	"could_not_delete_page_from_lru",
+	"alloc_huge_page_fail",
+	"ccgroup_charge_fail"
+};
+
+enum scan_result {
+	SCAN_OPERATION_FAIL,
+	SCAN_OPERATION_SUCCEED,
+	SCAN_PMD_NULL,
+	SCAN_EXCEED_NONE_PTE,
+	SCAN_PTE_NON_PRESENT,
+	SCAN_PAGE_RO,
+	SCAN_NO_REFERENCED_PAGE,
+	SCAN_PAGE_NULL,
+	SCAN_SCAN_ABORT,
+	SCAN_PAGE_COUNT,
+	SCAN_PAGE_LRU,
+	SCAN_PAGE_LOCK,
+	SCAN_PAGE_ANON,
+	SCAN_ANY_PROCESS,
+	SCAN_VMA_NULL,
+	SCAN_VMA_CHECK,
+	SCAN_ADDRESS_RANGE,
+	SCAN_SWAP_CACHE_PAGE,
+	SCAN_DEL_PAGE_LRU,
+	SCAN_ALLOC_HUGE_PAGE_FAIL,
+	SCAN_CGROUP_CHARGE_FAIL
+};
+
+#define CREATE_TRACE_POINTS
+#include <trace/events/huge_memory.h>
+
 /*
  * By default transparent hugepage support is disabled in order that avoid
  * to risk increase the memory footprint of applications without a guaranteed
@@ -2125,24 +2176,30 @@ static int __collapse_huge_page_isolate(struct vm_area_struct *vma,
 					unsigned long address,
 					pte_t *pte)
 {
-	struct page *page;
+	struct page *page = NULL;
 	pte_t *_pte;
-	int none_or_zero = 0;
+	int none_or_zero = 0, result = 0;
 	bool referenced = false, writable = false;
 	for (_pte = pte; _pte < pte+HPAGE_PMD_NR;
 	     _pte++, address += PAGE_SIZE) {
 		pte_t pteval = *_pte;
 		if (pte_none(pteval) || is_zero_pfn(pte_pfn(pteval))) {
-			if (++none_or_zero <= khugepaged_max_ptes_none)
+			if (++none_or_zero <= khugepaged_max_ptes_none) {
 				continue;
-			else
+			 } else {
+				result = SCAN_EXCEED_NONE_PTE;
 				goto out;
+			}
 		}
-		if (!pte_present(pteval))
+		if (!pte_present(pteval)) {
+			result = SCAN_PTE_NON_PRESENT;
 			goto out;
+		}
 		page = vm_normal_page(vma, address, pteval);
-		if (unlikely(!page))
+		if (unlikely(!page)) {
+			result = SCAN_PAGE_NULL;
 			goto out;
+		}
 
 		VM_BUG_ON_PAGE(PageCompound(page), page);
 		VM_BUG_ON_PAGE(!PageAnon(page), page);
@@ -2154,8 +2211,10 @@ static int __collapse_huge_page_isolate(struct vm_area_struct *vma,
 		 * is needed to serialize against split_huge_page
 		 * when invoked from the VM.
 		 */
-		if (!trylock_page(page))
+		if (!trylock_page(page)) {
+			result = SCAN_PAGE_LOCK;
 			goto out;
+		}
 
 		/*
 		 * cannot use mapcount: can't collapse if there's a gup pin.
@@ -2164,6 +2223,7 @@ static int __collapse_huge_page_isolate(struct vm_area_struct *vma,
 		 */
 		if (page_count(page) != 1 + !!PageSwapCache(page)) {
 			unlock_page(page);
+			result = SCAN_PAGE_COUNT;
 			goto out;
 		}
 		if (pte_write(pteval)) {
@@ -2171,6 +2231,7 @@ static int __collapse_huge_page_isolate(struct vm_area_struct *vma,
 		} else {
 			if (PageSwapCache(page) && !reuse_swap_page(page)) {
 				unlock_page(page);
+				result = SCAN_SWAP_CACHE_PAGE;
 				goto out;
 			}
 			/*
@@ -2185,6 +2246,7 @@ static int __collapse_huge_page_isolate(struct vm_area_struct *vma,
 		 */
 		if (isolate_lru_page(page)) {
 			unlock_page(page);
+			result = SCAN_DEL_PAGE_LRU;
 			goto out;
 		}
 		/* 0 stands for page_is_file_cache(page) == false */
@@ -2197,10 +2259,21 @@ static int __collapse_huge_page_isolate(struct vm_area_struct *vma,
 		    mmu_notifier_test_young(vma->vm_mm, address))
 			referenced = true;
 	}
-	if (likely(referenced && writable))
-		return 1;
+	if (likely(writable)) {
+		if (likely(referenced)) {
+			result = SCAN_OPERATION_SUCCEED;
+			trace_mm_collapse_huge_page_isolate(page_to_pfn(page), none_or_zero,
+							    referenced, writable, result);
+			return 1;
+		}
+	} else {
+		result = SCAN_PAGE_RO;
+	}
+
 out:
 	release_pte_pages(pte, _pte);
+	trace_mm_collapse_huge_page_isolate(page_to_pfn(page), none_or_zero,
+					    referenced, writable, result);
 	return 0;
 }
 
@@ -2435,7 +2508,7 @@ static void collapse_huge_page(struct mm_struct *mm,
 	pgtable_t pgtable;
 	struct page *new_page;
 	spinlock_t *pmd_ptl, *pte_ptl;
-	int isolated;
+	int isolated, result = 0;
 	unsigned long hstart, hend;
 	struct mem_cgroup *memcg;
 	unsigned long mmun_start;	/* For mmu_notifiers */
@@ -2450,12 +2523,16 @@ static void collapse_huge_page(struct mm_struct *mm,
 
 	/* release the mmap_sem read lock. */
 	new_page = khugepaged_alloc_page(hpage, gfp, mm, vma, address, node);
-	if (!new_page)
-		return;
+	if (!new_page) {
+		result = SCAN_ALLOC_HUGE_PAGE_FAIL;
+		goto out_nolock;
+	}
 
 	if (unlikely(mem_cgroup_try_charge(new_page, mm,
-					   gfp, &memcg)))
-		return;
+					   gfp, &memcg))) {
+		result = SCAN_CGROUP_CHARGE_FAIL;
+		goto out_nolock;
+	}
 
 	/*
 	 * Prevent all access to pagetables with the exception of
@@ -2463,21 +2540,31 @@ static void collapse_huge_page(struct mm_struct *mm,
 	 * handled by the anon_vma lock + PG_lock.
 	 */
 	down_write(&mm->mmap_sem);
-	if (unlikely(khugepaged_test_exit(mm)))
+	if (unlikely(khugepaged_test_exit(mm))) {
+		result = SCAN_ANY_PROCESS;
 		goto out;
+	}
 
 	vma = find_vma(mm, address);
-	if (!vma)
+	if (!vma) {
+		result = SCAN_VMA_NULL;
 		goto out;
+	}
 	hstart = (vma->vm_start + ~HPAGE_PMD_MASK) & HPAGE_PMD_MASK;
 	hend = vma->vm_end & HPAGE_PMD_MASK;
-	if (address < hstart || address + HPAGE_PMD_SIZE > hend)
+	if (address < hstart || address + HPAGE_PMD_SIZE > hend) {
+		result = SCAN_ADDRESS_RANGE;
 		goto out;
-	if (!hugepage_vma_check(vma))
+	}
+	if (!hugepage_vma_check(vma)) {
+		result = SCAN_VMA_CHECK;
 		goto out;
+	}
 	pmd = mm_find_pmd(mm, address);
-	if (!pmd)
+	if (!pmd) {
+		result = SCAN_PMD_NULL;
 		goto out;
+	}
 
 	anon_vma_lock_write(vma->anon_vma);
 
@@ -2514,6 +2601,7 @@ static void collapse_huge_page(struct mm_struct *mm,
 		pmd_populate(mm, pmd, pmd_pgtable(_pmd));
 		spin_unlock(pmd_ptl);
 		anon_vma_unlock_write(vma->anon_vma);
+		result = SCAN_OPERATION_FAIL;
 		goto out;
 	}
 
@@ -2551,10 +2639,15 @@ static void collapse_huge_page(struct mm_struct *mm,
 	*hpage = NULL;
 
 	khugepaged_pages_collapsed++;
+	result = SCAN_OPERATION_SUCCEED;
 out_up_write:
 	up_write(&mm->mmap_sem);
+	trace_mm_collapse_huge_page(mm, isolated, result);
 	return;
 
+out_nolock:
+	trace_mm_collapse_huge_page(mm, isolated, result);
+	return;
 out:
 	mem_cgroup_cancel_charge(new_page, memcg);
 	goto out_up_write;
@@ -2567,8 +2660,8 @@ static int khugepaged_scan_pmd(struct mm_struct *mm,
 {
 	pmd_t *pmd;
 	pte_t *pte, *_pte;
-	int ret = 0, none_or_zero = 0;
-	struct page *page;
+	int ret = 0, none_or_zero = 0, result = 0;
+	struct page *page = NULL;
 	unsigned long _address;
 	spinlock_t *ptl;
 	int node = NUMA_NO_NODE;
@@ -2577,8 +2670,10 @@ static int khugepaged_scan_pmd(struct mm_struct *mm,
 	VM_BUG_ON(address & ~HPAGE_PMD_MASK);
 
 	pmd = mm_find_pmd(mm, address);
-	if (!pmd)
+	if (!pmd) {
+		result = SCAN_PMD_NULL;
 		goto out;
+	}
 
 	memset(khugepaged_node_load, 0, sizeof(khugepaged_node_load));
 	pte = pte_offset_map_lock(mm, pmd, address, &ptl);
@@ -2586,19 +2681,25 @@ static int khugepaged_scan_pmd(struct mm_struct *mm,
 	     _pte++, _address += PAGE_SIZE) {
 		pte_t pteval = *_pte;
 		if (pte_none(pteval) || is_zero_pfn(pte_pfn(pteval))) {
-			if (++none_or_zero <= khugepaged_max_ptes_none)
+			if (++none_or_zero <= khugepaged_max_ptes_none) {
 				continue;
-			else
+			} else {
+				result = SCAN_EXCEED_NONE_PTE;
 				goto out_unmap;
+			}
 		}
-		if (!pte_present(pteval))
+		if (!pte_present(pteval)) {
+			result = SCAN_PTE_NON_PRESENT;
 			goto out_unmap;
+		}
 		if (pte_write(pteval))
 			writable = true;
 
 		page = vm_normal_page(vma, _address, pteval);
-		if (unlikely(!page))
+		if (unlikely(!page)) {
+			result = SCAN_PAGE_NULL;
 			goto out_unmap;
+		}
 		/*
 		 * Record which node the original page is from and save this
 		 * information to khugepaged_node_load[].
@@ -2606,25 +2707,47 @@ static int khugepaged_scan_pmd(struct mm_struct *mm,
 		 * hit record.
 		 */
 		node = page_to_nid(page);
-		if (khugepaged_scan_abort(node))
+		if (khugepaged_scan_abort(node)) {
+			result = SCAN_SCAN_ABORT;
 			goto out_unmap;
+		}
 		khugepaged_node_load[node]++;
 		VM_BUG_ON_PAGE(PageCompound(page), page);
-		if (!PageLRU(page) || PageLocked(page) || !PageAnon(page))
+		if (!PageLRU(page)) {
+			result = SCAN_SCAN_ABORT;
 			goto out_unmap;
+		}
+		if (PageLocked(page)) {
+			result = SCAN_PAGE_LOCK;
+			goto out_unmap;
+		}
+		if (!PageAnon(page)) {
+			result = SCAN_PAGE_ANON;
+			goto out_unmap;
+		}
 		/*
 		 * cannot use mapcount: can't collapse if there's a gup pin.
 		 * The page must only be referenced by the scanned process
 		 * and page swap cache.
 		 */
-		if (page_count(page) != 1 + !!PageSwapCache(page))
+		if (page_count(page) != 1 + !!PageSwapCache(page)) {
+			result = SCAN_PAGE_COUNT;
 			goto out_unmap;
+		}
 		if (pte_young(pteval) || PageReferenced(page) ||
 		    mmu_notifier_test_young(vma->vm_mm, address))
 			referenced = true;
 	}
-	if (referenced && writable)
-		ret = 1;
+	if (writable) {
+		if (referenced) {
+			result = SCAN_OPERATION_SUCCEED;
+			ret = 1;
+		} else {
+			result = SCAN_NO_REFERENCED_PAGE;
+		}
+	} else {
+		result = SCAN_PAGE_RO;
+	}
 out_unmap:
 	pte_unmap_unlock(pte, ptl);
 	if (ret) {
@@ -2633,6 +2756,8 @@ out_unmap:
 		collapse_huge_page(mm, address, hpage, vma, node);
 	}
 out:
+	trace_mm_khugepaged_scan_pmd(mm, page_to_pfn(page), writable, referenced,
+				     none_or_zero, result);
 	return ret;
 }
 
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1219141

FromVlastimil Babka <vbabka@suse.cz>
Date2015-09-04 18:10 +0200
Message-ID<q51IR-70a-3@gated-at.bofh.it>
In reply to#1218572
On 09/03/2015 10:51 PM, Ebru Akagunduz wrote:
> 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.
> 
> Signed-off-by: Ebru Akagunduz <ebru.akagunduz@gmail.com>
> Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
> Acked-by: Rik van Riel <riel@redhat.com>
> ---
> 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)

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 from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1219172

FromRik van Riel <riel@redhat.com>
Date2015-09-04 18:50 +0200
Message-ID<q52lB-7Jv-43@gated-at.bofh.it>
In reply to#1219141
On 09/04/2015 12:07 PM, Vlastimil Babka wrote:
> On 09/03/2015 10:51 PM, Ebru Akagunduz wrote:
>> 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.
>>
>> Signed-off-by: Ebru Akagunduz <ebru.akagunduz@gmail.com>
>> Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
>> Acked-by: Rik van Riel <riel@redhat.com>
>> ---
>> 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)
> 
> 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

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?

-- 
All rights reversed
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1219616

FromEbru Akagunduz <ebru.akagunduz@gmail.com>
Date2015-09-05 21:30 +0200
Message-ID<q5rjY-1gU-23@gated-at.bofh.it>
In reply to#1219172
On Fri, Sep 04, 2015 at 12:44:59PM -0400, Rik van Riel wrote:
> On 09/04/2015 12:07 PM, Vlastimil Babka wrote:
> > On 09/03/2015 10:51 PM, Ebru Akagunduz wrote:
> >> 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.
> >>
> >> Signed-off-by: Ebru Akagunduz <ebru.akagunduz@gmail.com>
> >> Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
> >> Acked-by: Rik van Riel <riel@redhat.com>
> >> ---
> >> 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)
> > 
> > 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

I use perf tool to test changes.
> 
> 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?
> 
I did similar changes with Vlastimil's patch. It works!

Thanks,
Ebru
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web