All of lore.kernel.org
 help / color / mirror / Atom feed
From: Li Zefan <lizefan@huawei.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2/2][RESEND] tracing: Shrink the size of struct ftrace_event_field
Date: Sat, 27 Jul 2013 11:13:13 +0800	[thread overview]
Message-ID: <51F33AC9.3040603@huawei.com> (raw)
In-Reply-To: <1374851376.6580.34.camel@gandalf.local.home>

>> @@ -111,6 +111,11 @@ static int __trace_define_field(struct list_head *head, const char *type,
>>  	field->size = size;
>>  	field->is_signed = is_signed;
> 
> I think we should just change is_signed to bool. At least the parameter.
> Or we can make the assignment: field->is_signed = !!is_signed; and nuke
> the check below.
> 

Changing field->is_signed to bool won't shrink the size of the struct.
I prefer: field->is_signed = !!is_signed.

>>  
>> +	WARN_ON(offset >= (1 << 12));
>> +	WARN_ON(size >= (1 << 12));
>> +	WARN_ON(is_signed >= (1 << 1));
>> +	WARN_ON(field->filter_type >= (1 << 4));
> 
> Note, the test for field->filter_type is wrong.
> 

oops.

> We should make a helper macro:
> 
> #define VERIFY_SIZE(type) WARN_ON(type > field->type)
> 

Much better!

> and then have:
> 
> 	VERIFY_SIZE(offset);
> 	VERIFY_SIZE(size);
> 	VERIFY_SIZE(filter_type);


  reply	other threads:[~2013-07-27  3:14 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-25  2:27 [PATCH 1/2][RESEND] tracing/syscalls: Annotate raw_init function with __init Li Zefan
2013-07-25  2:28 ` [PATCH 2/2][RESEND] tracing: Shrink the size of struct ftrace_event_field Li Zefan
2013-07-26 15:09   ` Steven Rostedt
2013-07-27  3:13     ` Li Zefan [this message]
2013-07-27  3:32     ` [PATCH v2 2/2] " Li Zefan
2013-07-27  3:47       ` Steven Rostedt
2013-07-27  8:45         ` Borislav Petkov
2013-07-27 11:35           ` Steven Rostedt
2013-07-27 16:19             ` Borislav Petkov
2013-07-29  2:14             ` [PATCH v3 " Li Zefan
2013-07-29  2:10           ` [PATCH v2 " Li Zefan
2013-07-26 14:23 ` [PATCH 1/2][RESEND] tracing/syscalls: Annotate raw_init function with __init Steven Rostedt

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=51F33AC9.3040603@huawei.com \
    --to=lizefan@huawei.com \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.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.