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


Groups > linux.kernel > #1451406

Re: [PATCH 1/2] mm: page_alloc.c: Add tracepoints for slowpath

From Michal Hocko <mhocko@kernel.org>
Newsgroups linux.kernel
Subject Re: [PATCH 1/2] mm: page_alloc.c: Add tracepoints for slowpath
Date 2016-07-27 18:40 +0200
Message-ID <rZA2d-1MN-7@gated-at.bofh.it> (permalink)
References <rZyjM-F9-5@gated-at.bofh.it> <rZyjM-F9-11@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Wed 27-07-16 10:47:59, Janani Ravichandran wrote:
> Add tracepoints to the slowpath code to gather some information.
> The tracepoints can also be used to find out how much time was spent in
> the slowpath.

I do not think this is a right thing to measure. __alloc_pages_slowpath
is more a code organization thing. The fast path might perform an
expensive operations like zone reclaim (if node_reclaim_mode > 0) so
these trace point would miss it.

__alloc_pages_nodemask already has a trace point after the allocation
request is done. This alone is not sufficient to measure the allocation
latency which is the main point of this patch AFAIU. Wouldn't it be
better to add another trace point when we enter __alloc_pages_nodemask?

> Signed-off-by: Janani Ravichandran <janani.rvchndrn@gmail.com>
> ---
>  include/trace/events/kmem.h | 40 ++++++++++++++++++++++++++++++++++++++++
>  mm/page_alloc.c             |  5 +++++
>  2 files changed, 45 insertions(+)
> 
> diff --git a/include/trace/events/kmem.h b/include/trace/events/kmem.h
> index 6b2e154..c19ab9f 100644
> --- a/include/trace/events/kmem.h
> +++ b/include/trace/events/kmem.h
> @@ -169,6 +169,46 @@ TRACE_EVENT(mm_page_free,
>  			__entry->order)
>  );
>  
> +TRACE_EVENT(mm_slowpath_begin,
> +
> +	TP_PROTO(gfp_t gfp_mask, int order),
> +
> +	TP_ARGS(gfp_mask, order),
> +
> +	TP_STRUCT__entry(
> +		__field(gfp_t, gfp_mask)
> +		__field(int, order)
> +	),
> +
> +	TP_fast_assign(
> +		__entry->gfp_mask = gfp_mask;
> +		__entry->order = order;
> +	),
> +
> +	TP_printk("gfp_mask:%s order=%d",
> +		show_gfp_flags(__entry->gfp_mask),
> +		__entry->order)
> +);
> +
> +TRACE_EVENT(mm_slowpath_end,
> +
> +	TP_PROTO(struct page *page),
> +
> +	TP_ARGS(page),
> +
> +	TP_STRUCT__entry(
> +		__field(unsigned long, pfn)
> +	),
> +
> +	TP_fast_assign(
> +		__entry->pfn = page ? page_to_pfn(page) : -1UL;
> +	),
> +
> +	TP_printk("page=%p pfn=%lu",
> +		__entry->pfn != -1UL ? pfn_to_page(__entry->pfn) : NULL,
> +		__entry->pfn != -1UL ? __entry->pfn : 0)
> +);
> +
>  TRACE_EVENT(mm_page_free_batched,
>  
>  	TP_PROTO(struct page *page, int cold),
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index 8b3e134..be9c688 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -3595,6 +3595,8 @@ __alloc_pages_slowpath(gfp_t gfp_mask, unsigned int order,
>  				(__GFP_ATOMIC|__GFP_DIRECT_RECLAIM)))
>  		gfp_mask &= ~__GFP_ATOMIC;
>  
> +	trace_mm_slowpath_begin(gfp_mask, order);
> +
>  retry:
>  	if (gfp_mask & __GFP_KSWAPD_RECLAIM)
>  		wake_all_kswapds(order, ac);
> @@ -3769,6 +3771,9 @@ noretry:
>  nopage:
>  	warn_alloc_failed(gfp_mask, order, NULL);
>  got_pg:
> +
> +	trace_mm_slowpath_end(page);
> +
>  	return page;
>  }
>  
> -- 
> 2.7.0
> 

-- 
Michal Hocko
SUSE Labs

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/2] New tracepoints for slowpath and memory compaction Janani Ravichandran <janani.rvchndrn@gmail.com> - 2016-07-27 16:50 +0200
  [PATCH 1/2] mm: page_alloc.c: Add tracepoints for slowpath Janani Ravichandran <janani.rvchndrn@gmail.com> - 2016-07-27 16:50 +0200
    Re: [PATCH 1/2] mm: page_alloc.c: Add tracepoints for slowpath Steven Rostedt <rostedt@goodmis.org> - 2016-07-27 17:30 +0200
      Re: [PATCH 1/2] mm: page_alloc.c: Add tracepoints for slowpath Dave Hansen <dave.hansen@intel.com> - 2016-07-27 19:30 +0200
        Re: [PATCH 1/2] mm: page_alloc.c: Add tracepoints for slowpath Steven Rostedt <rostedt@goodmis.org> - 2016-07-27 19:40 +0200
      Re: [PATCH 1/2] mm: page_alloc.c: Add tracepoints for slowpath Janani Ravichandran <janani.rvchndrn@gmail.com> - 2016-07-28 22:20 +0200
        Re: [PATCH 1/2] mm: page_alloc.c: Add tracepoints for slowpath Steven Rostedt <rostedt@goodmis.org> - 2016-08-04 17:30 +0200
          Re: [PATCH 1/2] mm: page_alloc.c: Add tracepoints for slowpath Janani Ravichandran <janani.rvchndrn@gmail.com> - 2016-08-05 18:20 +0200
            Re: [PATCH 1/2] mm: page_alloc.c: Add tracepoints for slowpath Steven Rostedt <rostedt@goodmis.org> - 2016-08-05 18:40 +0200
              Re: [PATCH 1/2] mm: page_alloc.c: Add tracepoints for slowpath Janani Ravichandran <janani.rvchndrn@gmail.com> - 2016-08-07 12:40 +0200
    Re: [PATCH 1/2] mm: page_alloc.c: Add tracepoints for slowpath Michal Hocko <mhocko@kernel.org> - 2016-07-27 18:40 +0200
      Re: [PATCH 1/2] mm: page_alloc.c: Add tracepoints for slowpath Rik van Riel <riel@surriel.com> - 2016-07-27 20:20 +0200
        Re: [PATCH 1/2] mm: page_alloc.c: Add tracepoints for slowpath Steven Rostedt <rostedt@goodmis.org> - 2016-07-27 20:30 +0200
        Re: [PATCH 1/2] mm: page_alloc.c: Add tracepoints for slowpath Michal Hocko <mhocko@kernel.org> - 2016-07-27 20:50 +0200
          Re: [PATCH 1/2] mm: page_alloc.c: Add tracepoints for slowpath Rik van Riel <riel@surriel.com> - 2016-07-27 21:00 +0200
  [PATCH 2/2] mm: compaction.c: Add/Modify direct compaction  tracepoints Janani Ravichandran <janani.rvchndrn@gmail.com> - 2016-07-27 17:00 +0200
    Re: [PATCH 2/2] mm: compaction.c: Add/Modify direct compaction  tracepoints Steven Rostedt <rostedt@goodmis.org> - 2016-07-27 17:30 +0200
    Re: [PATCH 2/2] mm: compaction.c: Add/Modify direct compaction  tracepoints Vlastimil Babka <vbabka@suse.cz> - 2016-08-01 15:30 +0200
      Re: [PATCH 2/2] mm: compaction.c: Add/Modify direct compaction tracepoints Janani Ravichandran <janani.rvchndrn@gmail.com> - 2016-08-07 14:40 +0200

csiph-web