Skip to content

Commit

Permalink
mm: get rid of unnecessary overhead of trace_mm_page_alloc_extfrag()
Browse files Browse the repository at this point in the history
In general, every tracepoint should be zero overhead if it is disabled.
However, trace_mm_page_alloc_extfrag() is one of exception.  It evaluate
"new_type == start_migratetype" even if tracepoint is disabled.

However, the code can be moved into tracepoint's TP_fast_assign() and
TP_fast_assign exist exactly such purpose.  This patch does it.

Signed-off-by: KOSAKI Motohiro <[email protected]>
Acked-by: Mel Gorman <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
kosaki authored and torvalds committed Nov 13, 2013
1 parent 5d0f3f7 commit 52c8f6a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
10 changes: 4 additions & 6 deletions include/trace/events/kmem.h
Original file line number Diff line number Diff line change
Expand Up @@ -267,14 +267,12 @@ DEFINE_EVENT_PRINT(mm_page, mm_page_pcpu_drain,
TRACE_EVENT(mm_page_alloc_extfrag,

TP_PROTO(struct page *page,
int alloc_order, int fallback_order,
int alloc_migratetype, int fallback_migratetype,
int change_ownership),
int alloc_order, int fallback_order,
int alloc_migratetype, int fallback_migratetype, int new_migratetype),

TP_ARGS(page,
alloc_order, fallback_order,
alloc_migratetype, fallback_migratetype,
change_ownership),
alloc_migratetype, fallback_migratetype, new_migratetype),

TP_STRUCT__entry(
__field( struct page *, page )
Expand All @@ -291,7 +289,7 @@ TRACE_EVENT(mm_page_alloc_extfrag,
__entry->fallback_order = fallback_order;
__entry->alloc_migratetype = alloc_migratetype;
__entry->fallback_migratetype = fallback_migratetype;
__entry->change_ownership = change_ownership;
__entry->change_ownership = (new_migratetype == alloc_migratetype);
),

TP_printk("page=%p pfn=%lu alloc_order=%d fallback_order=%d pageblock_order=%d alloc_migratetype=%d fallback_migratetype=%d fragmenting=%d change_ownership=%d",
Expand Down
5 changes: 2 additions & 3 deletions mm/page_alloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1103,9 +1103,8 @@ __rmqueue_fallback(struct zone *zone, int order, int start_migratetype)
is_migrate_cma(migratetype)
? migratetype : start_migratetype);

trace_mm_page_alloc_extfrag(page, order,
current_order, start_migratetype, migratetype,
new_type == start_migratetype);
trace_mm_page_alloc_extfrag(page, order, current_order,
start_migratetype, migratetype, new_type);

return page;
}
Expand Down

0 comments on commit 52c8f6a

Please sign in to comment.