mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Shuah Khan <shuahkh@osg.samsung.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: mingo@redhat.com, gregkh@linuxfoundation.org,
	linux-kernel@vger.kernel.org,
	Shuah Khan <shuahkh@osg.samsung.com>
Subject: Re: [PATCH 1/3] kobject: add kobject trace points
Date: Wed, 7 Sep 2016 17:25:24 -0600	[thread overview]
Message-ID: <9b79c4da-355d-6835-2afa-8fb16bb4b2b7@osg.samsung.com> (raw)
In-Reply-To: <20160906140544.3a46f056@gandalf.local.home>


[-- Attachment #1.1: Type: text/plain, Size: 2352 bytes --]

On 09/06/2016 12:05 PM, Steven Rostedt wrote:
> On Tue,  6 Sep 2016 11:49:23 -0600
> Shuah Khan <shuahkh@osg.samsung.com> wrote:
> 
>> +#if !defined(_TRACE_KOBJECT_H) || defined(TRACE_HEADER_MULTI_READ)
>> +#define _TRACE_KOBJECT_H
>> +
>> +#include <linux/tracepoint.h>
>> +#include <linux/kobject.h>
>> +
>> +/* kobject_init_class */
>> +DECLARE_EVENT_CLASS(kobject_init_class,
>> +
>> +	TP_PROTO(struct kobject *kobj),
>> +
>> +	TP_ARGS(kobj),
>> +
>> +	TP_STRUCT__entry(
>> +		__field(void *, kobj)
>> +		__field(int, state_initialized)
>> +	),
>> +
>> +	TP_fast_assign(
>> +		__entry->kobj = kobj;
>> +		__entry->state_initialized = kobj->state_initialized;
>> +	),
>> +
>> +	TP_printk("KOBJECT: %p state=%d",
>> +		  __entry->kobj,
>> +		  __entry->state_initialized
>> +	));
>> +
>> +/**
>> + * kobject_init	- called from kobject_init() when kobject is initialized
>> + * @kobj:	- pointer to struct kobject
>> + */
>> +DEFINE_EVENT(kobject_init_class, kobject_init,
>> +
>> +	TP_PROTO(struct kobject *kobj),
>> +	TP_ARGS(kobj));
>> +
>> +/* kobject_class */
>> +DECLARE_EVENT_CLASS(kobject_class,
>> +
>> +	TP_PROTO(struct kobject *kobj),
>> +	TP_ARGS(kobj),
>> +
>> +	TP_STRUCT__entry(
>> +		__field(void *, kobj)
>> +		__string(name, kobject_name(kobj))
>> +		__field(int, state_initialized)
>> +		__field(void *, parent)
>> +		__string(pname, kobj->parent ? kobject_name(kobj->parent) : "")
>> +		__field(int, count)
>> +	),
> 
> state_initialized looks to be a single bit. As you have two dynamic
> strings, it may be best to move this around and possibly save 3 bytes.
> Also, dynamic strings take 4 bytes, and pointers are 8 bytes on 64 bit
> machines, we want to move those too.
> 
> 	__field(void *, kobj)
> 	__field(void *, parent)
> 	__field(int, count)
> 	__string(name, ...)
> 	__string(pname, ...)
> 	__field(char, state_initialized)
> 
> This will compact the event a bit better.
> 
> -- Steve
> 

Nice. I should start thinking about efficient data structure packing
again. Used to do that a lot in the past when I worked on small embedded
systems.

I made the change and patch is ready, but holding off on sending the v2
of this patch until we conclude our tracepoint discussion at the kernel
summit and make some decisions.

thanks,
-- Shuah



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

  reply	other threads:[~2016-09-07 23:26 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-06 17:49 [PATCH 0/3] kobject tracepoints Shuah Khan
2016-09-06 17:49 ` [PATCH 1/3] kobject: add kobject trace points Shuah Khan
2016-09-06 18:05   ` Steven Rostedt
2016-09-07 23:25     ` Shuah Khan [this message]
2016-09-06 17:49 ` [PATCH 2/3] kobject: add kobject trace prototypes Shuah Khan
2016-09-06 17:49 ` [PATCH 3/3] kobject: Add calls to kobject trace points Shuah Khan
2016-09-06 19:30 ` [PATCH 0/3] kobject tracepoints Greg KH
2016-09-06 20:19   ` Shuah Khan
2016-09-07  5:48     ` Greg KH

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=9b79c4da-355d-6835-2afa-8fb16bb4b2b7@osg.samsung.com \
    --to=shuahkh@osg.samsung.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®