All of lore.kernel.org
 help / color / mirror / Atom feed
From: Namhyung Kim <namhyung@kernel.org>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>,
	Ingo Molnar <mingo@kernel.org>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Jiri Olsa <jolsa@redhat.com>, LKML <linux-kernel@vger.kernel.org>,
	David Ahern <dsahern@gmail.com>, Minchan Kim <minchan@kernel.org>,
	Joonsoo Kim <js1304@gmail.com>,
	linux-mm@kvack.org
Subject: Re: [PATCH 9/9] tools lib traceevent: Honor operator priority
Date: Tue, 7 Apr 2015 16:52:26 +0900	[thread overview]
Message-ID: <20150407075226.GE23913@sejong> (raw)
In-Reply-To: <20150406104504.41e398d3@gandalf.local.home>

Hi Steve,

On Mon, Apr 06, 2015 at 10:45:04AM -0400, Steven Rostedt wrote:
> On Mon,  6 Apr 2015 14:36:16 +0900
> Namhyung Kim <namhyung@kernel.org> wrote:
> 
> > Currently it ignores operator priority and just sets processed args as a
> > right operand.  But it could result in priority inversion in case that
> > the right operand is also a operator arg and its priority is lower.
> > 
> > For example, following print format is from new kmem events.
> > 
> >   "page=%p", REC->pfn != -1UL ? (((struct page *)(0xffffea0000000000UL)) + (REC->pfn)) : ((void *)0)
> > 
> > But this was treated as below:
> > 
> >   REC->pfn != ((null - 1UL) ? ((struct page *)0xffffea0000000000UL + REC->pfn) : (void *) 0)
> > 
> > In this case, the right arg was '?' operator which has lower priority.
> > But it just sets the whole arg so making the output confusing - page was
> > always 0 or 1 since that's the result of logical operation.
> > 
> > With this patch, it can handle it properly like following:
> > 
> >   ((REC->pfn != (null - 1UL)) ? ((struct page *)0xffffea0000000000UL + REC->pfn) : (void *) 0)
> 
> Nice catch. One nit.
> 
> > 
> > Cc: Steven Rostedt <rostedt@goodmis.org>
> > Signed-off-by: Namhyung Kim <namhyung@kernel.org>
> > ---
> >  tools/lib/traceevent/event-parse.c | 17 ++++++++++++++++-
> >  1 file changed, 16 insertions(+), 1 deletion(-)
> > 
> > diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/event-parse.c
> > index 6d31b6419d37..604bea5c3fb0 100644
> > --- a/tools/lib/traceevent/event-parse.c
> > +++ b/tools/lib/traceevent/event-parse.c
> > @@ -1939,7 +1939,22 @@ process_op(struct event_format *event, struct print_arg *arg, char **tok)
> >  			goto out_warn_free;
> >  
> >  		type = process_arg_token(event, right, tok, type);
> > -		arg->op.right = right;
> > +
> > +		if (right->type == PRINT_OP &&
> > +		    get_op_prio(arg->op.op) < get_op_prio(right->op.op)) {
> > +			struct print_arg tmp;
> > +
> > +			/* swap ops according to the priority */
> 
> This isn't really a swap. Better term to use is "rotate".

You're right!

> 
> But other than that,
> 
> Acked-by: Steven Rostedt <rostedt@goodmis.org>

Thanks for the review
Namhyung


> 
> > +			arg->op.right = right->op.left;
> > +
> > +			tmp = *arg;
> > +			*arg = *right;
> > +			*right = tmp;
> > +
> > +			arg->op.left = right;
> > +		} else {
> > +			arg->op.right = right;
> > +		}
> >  
> >  	} else if (strcmp(token, "[") == 0) {
> >  
> 
> --
> 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/

WARNING: multiple messages have this Message-ID (diff)
From: Namhyung Kim <namhyung@kernel.org>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>,
	Ingo Molnar <mingo@kernel.org>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Jiri Olsa <jolsa@redhat.com>, LKML <linux-kernel@vger.kernel.org>,
	David Ahern <dsahern@gmail.com>, Minchan Kim <minchan@kernel.org>,
	Joonsoo Kim <js1304@gmail.com>,
	linux-mm@kvack.org
Subject: Re: [PATCH 9/9] tools lib traceevent: Honor operator priority
Date: Tue, 7 Apr 2015 16:52:26 +0900	[thread overview]
Message-ID: <20150407075226.GE23913@sejong> (raw)
In-Reply-To: <20150406104504.41e398d3@gandalf.local.home>

Hi Steve,

On Mon, Apr 06, 2015 at 10:45:04AM -0400, Steven Rostedt wrote:
> On Mon,  6 Apr 2015 14:36:16 +0900
> Namhyung Kim <namhyung@kernel.org> wrote:
> 
> > Currently it ignores operator priority and just sets processed args as a
> > right operand.  But it could result in priority inversion in case that
> > the right operand is also a operator arg and its priority is lower.
> > 
> > For example, following print format is from new kmem events.
> > 
> >   "page=%p", REC->pfn != -1UL ? (((struct page *)(0xffffea0000000000UL)) + (REC->pfn)) : ((void *)0)
> > 
> > But this was treated as below:
> > 
> >   REC->pfn != ((null - 1UL) ? ((struct page *)0xffffea0000000000UL + REC->pfn) : (void *) 0)
> > 
> > In this case, the right arg was '?' operator which has lower priority.
> > But it just sets the whole arg so making the output confusing - page was
> > always 0 or 1 since that's the result of logical operation.
> > 
> > With this patch, it can handle it properly like following:
> > 
> >   ((REC->pfn != (null - 1UL)) ? ((struct page *)0xffffea0000000000UL + REC->pfn) : (void *) 0)
> 
> Nice catch. One nit.
> 
> > 
> > Cc: Steven Rostedt <rostedt@goodmis.org>
> > Signed-off-by: Namhyung Kim <namhyung@kernel.org>
> > ---
> >  tools/lib/traceevent/event-parse.c | 17 ++++++++++++++++-
> >  1 file changed, 16 insertions(+), 1 deletion(-)
> > 
> > diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/event-parse.c
> > index 6d31b6419d37..604bea5c3fb0 100644
> > --- a/tools/lib/traceevent/event-parse.c
> > +++ b/tools/lib/traceevent/event-parse.c
> > @@ -1939,7 +1939,22 @@ process_op(struct event_format *event, struct print_arg *arg, char **tok)
> >  			goto out_warn_free;
> >  
> >  		type = process_arg_token(event, right, tok, type);
> > -		arg->op.right = right;
> > +
> > +		if (right->type == PRINT_OP &&
> > +		    get_op_prio(arg->op.op) < get_op_prio(right->op.op)) {
> > +			struct print_arg tmp;
> > +
> > +			/* swap ops according to the priority */
> 
> This isn't really a swap. Better term to use is "rotate".

You're right!

> 
> But other than that,
> 
> Acked-by: Steven Rostedt <rostedt@goodmis.org>

Thanks for the review
Namhyung


> 
> > +			arg->op.right = right->op.left;
> > +
> > +			tmp = *arg;
> > +			*arg = *right;
> > +			*right = tmp;
> > +
> > +			arg->op.left = right;
> > +		} else {
> > +			arg->op.right = right;
> > +		}
> >  
> >  	} else if (strcmp(token, "[") == 0) {
> >  
> 
> --
> 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/

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2015-04-07  7:58 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-06  5:36 [PATCHSET 0/9] perf kmem: Implement page allocation analysis (v6) Namhyung Kim
2015-04-06  5:36 ` Namhyung Kim
2015-04-06  5:36 ` [PATCH 1/9] perf kmem: Respect -i option Namhyung Kim
2015-04-06  5:36   ` Namhyung Kim
2015-04-08 15:11   ` [tip:perf/core] " tip-bot for Jiri Olsa
2015-04-06  5:36 ` [PATCH 2/9] tracing, mm: Record pfn instead of pointer to struct page Namhyung Kim
2015-04-06  5:36   ` Namhyung Kim
2015-04-14 12:16   ` [tip:perf/urgent] " tip-bot for Namhyung Kim
2015-04-06  5:36 ` [PATCH 3/9] perf kmem: Analyze page allocator events also Namhyung Kim
2015-04-06  5:36   ` Namhyung Kim
2015-04-10 21:06   ` Arnaldo Carvalho de Melo
2015-04-10 21:06     ` Arnaldo Carvalho de Melo
2015-04-10 21:10     ` Arnaldo Carvalho de Melo
2015-04-10 21:10       ` Arnaldo Carvalho de Melo
2015-04-13  6:59       ` Namhyung Kim
2015-04-13  6:59         ` Namhyung Kim
2015-04-13 13:21         ` Arnaldo Carvalho de Melo
2015-04-13 13:21           ` Arnaldo Carvalho de Melo
2015-04-13 13:40   ` Arnaldo Carvalho de Melo
2015-04-13 13:40     ` Arnaldo Carvalho de Melo
2015-04-14 12:17   ` [tip:perf/urgent] " tip-bot for Namhyung Kim
2015-04-06  5:36 ` [PATCH 4/9] perf kmem: Implement stat --page --caller Namhyung Kim
2015-04-06  5:36   ` Namhyung Kim
2015-04-13 13:40   ` Arnaldo Carvalho de Melo
2015-04-13 13:40     ` Arnaldo Carvalho de Melo
2015-04-14  2:17     ` Namhyung Kim
2015-04-14  2:17       ` Namhyung Kim
2015-04-06  5:36 ` [PATCH 5/9] perf kmem: Support sort keys on page analysis Namhyung Kim
2015-04-06  5:36   ` Namhyung Kim
2015-04-06  5:36 ` [PATCH 6/9] perf kmem: Add --live option for current allocation stat Namhyung Kim
2015-04-06  5:36   ` Namhyung Kim
2015-04-06  5:36 ` [PATCH 7/9] perf kmem: Print gfp flags in human readable string Namhyung Kim
2015-04-06  5:36   ` Namhyung Kim
2015-04-06  5:36 ` [PATCH 8/9] perf kmem: Add kmem.default config option Namhyung Kim
2015-04-06  5:36   ` Namhyung Kim
2015-04-06  5:36 ` [PATCH 9/9] tools lib traceevent: Honor operator priority Namhyung Kim
2015-04-06  5:36   ` Namhyung Kim
2015-04-06 14:45   ` Steven Rostedt
2015-04-06 14:45     ` Steven Rostedt
2015-04-07  7:52     ` Namhyung Kim [this message]
2015-04-07  7:52       ` Namhyung Kim
2015-04-07 13:02       ` Arnaldo Carvalho de Melo
2015-04-07 13:02         ` Arnaldo Carvalho de Melo
2015-04-07 13:57         ` Steven Rostedt
2015-04-07 13:57           ` Steven Rostedt
2015-04-07 14:10         ` Namhyung Kim
2015-04-07 14:10           ` Namhyung Kim
2015-04-08 15:11   ` [tip:perf/core] " tip-bot for Namhyung Kim
2015-04-13 13:41   ` [PATCH 9/9] " Arnaldo Carvalho de Melo
2015-04-13 13:41     ` Arnaldo Carvalho de Melo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150407075226.GE23913@sejong \
    --to=namhyung@kernel.org \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@kernel.org \
    --cc=dsahern@gmail.com \
    --cc=jolsa@redhat.com \
    --cc=js1304@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=minchan@kernel.org \
    --cc=mingo@kernel.org \
    --cc=rostedt@goodmis.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.