* [PATCH 1/2] tracing/syscalls: Annotate raw_init function with __init
@ 2013-03-27 6:15 Li Zefan
2013-03-27 6:16 ` [PATCH 2/2] tracing: Shrink the size of struct ftrace_event_field Li Zefan
0 siblings, 1 reply; 2+ messages in thread
From: Li Zefan @ 2013-03-27 6:15 UTC (permalink / raw)
To: Steven Rostedt; +Cc: Frederic Weisbecker, LKML
init_syscall_trace() can be called during kernel bootup only, so we can
mark it and the functions it calls as __init.
Signed-off-by: Li Zefan <lizefan@huawei.com>
---
kernel/trace/trace_syscalls.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/kernel/trace/trace_syscalls.c b/kernel/trace/trace_syscalls.c
index 8f2ac73..1de2ba6 100644
--- a/kernel/trace/trace_syscalls.c
+++ b/kernel/trace/trace_syscalls.c
@@ -200,8 +200,8 @@ extern char *__bad_type_size(void);
#type, #name, offsetof(typeof(trace), name), \
sizeof(trace.name), is_signed_type(type)
-static
-int __set_enter_print_fmt(struct syscall_metadata *entry, char *buf, int len)
+static int __init
+__set_enter_print_fmt(struct syscall_metadata *entry, char *buf, int len)
{
int i;
int pos = 0;
@@ -228,7 +228,7 @@ int __set_enter_print_fmt(struct syscall_metadata *entry, char *buf, int len)
return pos;
}
-static int set_syscall_print_fmt(struct ftrace_event_call *call)
+static int __init set_syscall_print_fmt(struct ftrace_event_call *call)
{
char *print_fmt;
int len;
@@ -253,7 +253,7 @@ static int set_syscall_print_fmt(struct ftrace_event_call *call)
return 0;
}
-static void free_syscall_print_fmt(struct ftrace_event_call *call)
+static void __init free_syscall_print_fmt(struct ftrace_event_call *call)
{
struct syscall_metadata *entry = call->data;
@@ -446,7 +446,7 @@ static void unreg_event_syscall_exit(struct ftrace_event_file *file,
mutex_unlock(&syscall_trace_lock);
}
-static int init_syscall_trace(struct ftrace_event_call *call)
+static int __init init_syscall_trace(struct ftrace_event_call *call)
{
int id;
int num;
--
1.8.0.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [PATCH 2/2] tracing: Shrink the size of struct ftrace_event_field
2013-03-27 6:15 [PATCH 1/2] tracing/syscalls: Annotate raw_init function with __init Li Zefan
@ 2013-03-27 6:16 ` Li Zefan
0 siblings, 0 replies; 2+ messages in thread
From: Li Zefan @ 2013-03-27 6:16 UTC (permalink / raw)
To: Steven Rostedt; +Cc: Frederic Weisbecker, LKML
Use bit fields, and the size of struct ftrace_event_field can be
shrunk from 48 bytes to 40 bytes on 64bit kernel.
slab_name active_obj nr_obj size obj_per_slab
---------------------------------------------
ftrace_event_field 1105 1105 48 85 (before)
ftrace_event_field 1224 1224 40 102 (after)
This saves a few Kbytes: (1224 * 40) - (1105 * 48) = 4080
Signed-off-by: Li Zefan <lizefan@huawei.com>
---
kernel/trace/trace.h | 8 ++++----
kernel/trace/trace_events.c | 5 +++++
2 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h
index 9e01458..a3365a4 100644
--- a/kernel/trace/trace.h
+++ b/kernel/trace/trace.h
@@ -916,10 +916,10 @@ struct ftrace_event_field {
struct list_head link;
const char *name;
const char *type;
- int filter_type;
- int offset;
- int size;
- int is_signed;
+ unsigned int filter_type:4;
+ unsigned int offset:12;
+ unsigned int size:12;
+ unsigned int is_signed:1;
};
struct event_filter {
diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c
index 53582e9..67aee85 100644
--- a/kernel/trace/trace_events.c
+++ b/kernel/trace/trace_events.c
@@ -111,6 +111,11 @@ static int __trace_define_field(struct list_head *head, const char *type,
field->size = size;
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));
+
list_add(&field->link, head);
return 0;
--
1.8.0.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-03-27 6:18 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-27 6:15 [PATCH 1/2] tracing/syscalls: Annotate raw_init function with __init Li Zefan
2013-03-27 6:16 ` [PATCH 2/2] tracing: Shrink the size of struct ftrace_event_field Li Zefan
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.