lkml.org 
[lkml]   [2015]   [Mar]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v4 1/5] mm: cma: add trace events to debug physically-contiguous memory allocations
On 19/03/15 23:34, Steven Rostedt wrote:
> On Thu, 19 Mar 2015 23:18:18 +0300
> Stefan Strogin <s.strogin@partner.samsung.com> wrote:
>
>> Thank you for the reply, Steven.
>> I supposed that page_to_pfn() cannot change after mem_map
>> initialization, can it? I'm not sure about such things as memory hotplug
>> though...
>> Also cma_alloc() calls alloc_contig_range() which returns pfn, then it's
>> converted to struct page * and cma_alloc() returns struct page *, and
>> vice versa in cma_release() (receives struct page * and passes pfn to
>> free_contig_rage()).
>> Do you mean that printing pfn (or struct page *) in trace event is
>> redundant?
>
> I'm concerned about the time TP_printk() is executed and when
> TP_fast_assign() is. That is, when the tracepoint is called,
> TP_fast_assign() is executed, but TP_printk() is called when someone
> reads the trace files, which can happen seconds, hours, days, weeks,
> months later.
>
> As long as the result of page_to_pfn() and pfn_to_page() stay the same
> throughout the life of the boot, things will be fine. But if they could
> ever change, due to hotplug memory or whatever. The data in the trace
> buffer will become stale, and report the wrong information.
>
> -- Steve
>

Ah, thanks, I see. So will this solve the described issue?
+ TP_fast_assign(
+ __entry->page = page;
+ __entry->pfn = page_to_pfn(__entry->page) : 0;
/* or -1 as Ingo suggested */
+ __entry->count = count;
+ ),
+
+ TP_printk("page=%p pfn=%lu count=%u",
+ __entry->page,
+ __entry->pfn,
+ __entry->count)

Should we do the same in trace/events/kmem.h then?

But really I'm not sure why page_to_pfn()/pfn_to_page() can return
different results... I thought that there can appear new 'struct page'
entries arrays throughout one boot due to memory hotplug or smth. But
how can existing 'struct page' entries associated with the same physical
pages change their physical addresses? Or how can one physical address
correspond to different physical page throughout one boot?


\
 
 \ /
  Last update: 2015-03-20 12:01    [W:0.066 / U:1.288 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site