From: Masami Hiramatsu <mhiramat@redhat.com>
To: Jason Baron <jbaron@redhat.com>
Cc: linux-kernel@vger.kernel.org, mingo@elte.hu,
mathieu.desnoyers@polymtl.ca, hpa@zytor.com, tglx@linutronix.de,
rostedt@goodmis.org, andi@firstfloor.org, roland@redhat.com,
rth@redhat.com, fweisbec@gmail.com
Subject: Re: [PATCH 2/5] jump label: base patch
Date: Fri, 26 Mar 2010 17:30:42 -0400 [thread overview]
Message-ID: <4BAD2782.3010704@redhat.com> (raw)
In-Reply-To: <79304b525d61cb0e7516cdee1ddcdb5ac3f2579a.1269272444.git.jbaron@redhat.com>
Jason Baron wrote:
> base patch to implement 'jump labeling'. Based on a new 'asm goto' inline
> assembly gcc mechanism, we can now branch to labels from an 'asm goto'
> statment. This allows us to create a 'no-op' fastpath, which can subsequently
> be patched with a jump to the slowpath code. This is useful for code which
> might be rarely used, but which we'd like to be able to call, if needed.
> Tracepoints are the current usecase that these are being implemented for.
>
> Signed-off-by: Jason Baron <jbaron@redhat.com>
> ---
> include/asm-generic/vmlinux.lds.h | 10 ++-
> include/linux/jump_label.h | 57 +++++++++++++
> kernel/Makefile | 2 +-
> kernel/jump_label.c | 165 +++++++++++++++++++++++++++++++++++++
> 4 files changed, 232 insertions(+), 2 deletions(-)
> create mode 100644 include/linux/jump_label.h
> create mode 100644 kernel/jump_label.c
>
> diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
> index 67e6520..83a469d 100644
> --- a/include/asm-generic/vmlinux.lds.h
> +++ b/include/asm-generic/vmlinux.lds.h
> @@ -167,7 +167,8 @@
> BRANCH_PROFILE() \
> TRACE_PRINTKS() \
> FTRACE_EVENTS() \
> - TRACE_SYSCALLS()
> + TRACE_SYSCALLS() \
> + JUMP_TABLE() \
Just a minor style issue: no need to add '\' on the last line.
>
> /*
> * Data section helpers
> @@ -206,6 +207,7 @@
> *(__vermagic) /* Kernel version magic */ \
> *(__markers_strings) /* Markers: strings */ \
> *(__tracepoints_strings)/* Tracepoints: strings */ \
> + *(__jump_strings)/* Jump: strings */ \
> } \
> \
Just a minor style issue: please align the tab.
[...]
> +static struct jump_label_entry *add_jump_label_entry(const char *name, int nr_entries, struct jump_entry *table)
> +{
> + struct hlist_head *head;
> + struct hlist_node *node;
> + struct jump_label_entry *e;
> + size_t name_len = strlen(name) + 1;
> + u32 hash = jhash(name, name_len-1, 0);
> +
> + head = &jump_label_table[hash & (JUMP_LABEL_TABLE_SIZE - 1)];
> + hlist_for_each_entry(e, node, head, hlist) {
> + if (!strcmp(name, e->name))
> + return ERR_PTR(-EEXIST);
> + }
> + e = kmalloc(sizeof(struct jump_label_entry) + name_len, GFP_KERNEL);
> + if (!e)
> + return ERR_PTR(-ENOMEM);
> + memcpy(&e->name[0], name, name_len);
Hmm, why don't you just have a pointer for e->name which points name?
Or, maybe you can find it easily from e->table[0].name (so you can save
some memory).
Thank you,
--
Masami Hiramatsu
e-mail: mhiramat@redhat.com
next prev parent reply other threads:[~2010-03-26 21:31 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-22 16:07 [PATCH 0/5] jump label v5 Jason Baron
2010-03-22 16:07 ` [PATCH 1/5] jump label: notifier atomic call chain notrace Jason Baron
2010-03-22 17:55 ` Masami Hiramatsu
2010-03-22 16:07 ` [PATCH 2/5] jump label: base patch Jason Baron
2010-03-22 20:04 ` Steven Rostedt
2010-03-22 21:01 ` Avi Kivity
2010-03-26 21:30 ` Masami Hiramatsu [this message]
2010-03-22 16:07 ` [PATCH 3/5] jump label: x86 support Jason Baron
2010-03-22 16:40 ` Steven Rostedt
2010-03-22 20:40 ` Jason Baron
2010-03-22 16:07 ` [PATCH 4/5] jump label: tracepoint support Jason Baron
2010-03-22 16:43 ` Steven Rostedt
2010-03-22 20:44 ` Jason Baron
2010-03-22 16:07 ` [PATCH 5/5] jump label: add module support Jason Baron
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=4BAD2782.3010704@redhat.com \
--to=mhiramat@redhat.com \
--cc=andi@firstfloor.org \
--cc=fweisbec@gmail.com \
--cc=hpa@zytor.com \
--cc=jbaron@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@polymtl.ca \
--cc=mingo@elte.hu \
--cc=roland@redhat.com \
--cc=rostedt@goodmis.org \
--cc=rth@redhat.com \
--cc=tglx@linutronix.de \
/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.