* [PATCH] trace/ftrace.c: remove redundant swap function
@ 2015-09-09 21:27 Rasmus Villemoes
2015-09-30 19:43 ` Rasmus Villemoes
0 siblings, 1 reply; 3+ messages in thread
From: Rasmus Villemoes @ 2015-09-09 21:27 UTC (permalink / raw)
To: Steven Rostedt, Ingo Molnar; +Cc: Rasmus Villemoes, linux-kernel
To cover the common case of sorting an array of pointers, Daniel
Wagner recently modified the library sort() to use a specific swap
function for size==8, in addition to the size==4 case which was
already handled. Since sizeof(long) is either 4 or 8,
ftrace_swap_ips() is redundant and we can just let sort() pick an
appropriate and fast swap callback.
Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
---
kernel/trace/ftrace.c | 13 +------------
1 file changed, 1 insertion(+), 12 deletions(-)
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index b0623ac785a2..186bafa9935d 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -4783,17 +4783,6 @@ static int ftrace_cmp_ips(const void *a, const void *b)
return 0;
}
-static void ftrace_swap_ips(void *a, void *b, int size)
-{
- unsigned long *ipa = a;
- unsigned long *ipb = b;
- unsigned long t;
-
- t = *ipa;
- *ipa = *ipb;
- *ipb = t;
-}
-
static int ftrace_process_locs(struct module *mod,
unsigned long *start,
unsigned long *end)
@@ -4813,7 +4802,7 @@ static int ftrace_process_locs(struct module *mod,
return 0;
sort(start, count, sizeof(*start),
- ftrace_cmp_ips, ftrace_swap_ips);
+ ftrace_cmp_ips, NULL);
start_pg = ftrace_allocate_pages(count);
if (!start_pg)
--
2.1.3
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] trace/ftrace.c: remove redundant swap function
2015-09-09 21:27 [PATCH] trace/ftrace.c: remove redundant swap function Rasmus Villemoes
@ 2015-09-30 19:43 ` Rasmus Villemoes
2015-10-01 13:34 ` Steven Rostedt
0 siblings, 1 reply; 3+ messages in thread
From: Rasmus Villemoes @ 2015-09-30 19:43 UTC (permalink / raw)
To: Steven Rostedt; +Cc: Ingo Molnar, linux-kernel
On Wed, Sep 09 2015, Rasmus Villemoes <linux@rasmusvillemoes.dk> wrote:
ping
> To cover the common case of sorting an array of pointers, Daniel
> Wagner recently modified the library sort() to use a specific swap
> function for size==8, in addition to the size==4 case which was
> already handled. Since sizeof(long) is either 4 or 8,
> ftrace_swap_ips() is redundant and we can just let sort() pick an
> appropriate and fast swap callback.
>
> Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
> ---
> kernel/trace/ftrace.c | 13 +------------
> 1 file changed, 1 insertion(+), 12 deletions(-)
>
> diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
> index b0623ac785a2..186bafa9935d 100644
> --- a/kernel/trace/ftrace.c
> +++ b/kernel/trace/ftrace.c
> @@ -4783,17 +4783,6 @@ static int ftrace_cmp_ips(const void *a, const void *b)
> return 0;
> }
>
> -static void ftrace_swap_ips(void *a, void *b, int size)
> -{
> - unsigned long *ipa = a;
> - unsigned long *ipb = b;
> - unsigned long t;
> -
> - t = *ipa;
> - *ipa = *ipb;
> - *ipb = t;
> -}
> -
> static int ftrace_process_locs(struct module *mod,
> unsigned long *start,
> unsigned long *end)
> @@ -4813,7 +4802,7 @@ static int ftrace_process_locs(struct module *mod,
> return 0;
>
> sort(start, count, sizeof(*start),
> - ftrace_cmp_ips, ftrace_swap_ips);
> + ftrace_cmp_ips, NULL);
>
> start_pg = ftrace_allocate_pages(count);
> if (!start_pg)
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] trace/ftrace.c: remove redundant swap function
2015-09-30 19:43 ` Rasmus Villemoes
@ 2015-10-01 13:34 ` Steven Rostedt
0 siblings, 0 replies; 3+ messages in thread
From: Steven Rostedt @ 2015-10-01 13:34 UTC (permalink / raw)
To: Rasmus Villemoes; +Cc: Ingo Molnar, linux-kernel
On Wed, 30 Sep 2015 21:43:38 +0200
Rasmus Villemoes <linux@rasmusvillemoes.dk> wrote:
> On Wed, Sep 09 2015, Rasmus Villemoes <linux@rasmusvillemoes.dk> wrote:
>
> ping
Both your patches look good. I applied both of them to my tree for the
4.4 window.
I'll post them to linux-next after they've gone through my test suite.
But currently my tests are running -rt code, and I may not get to them
till I get back from LinuxCon EU. But they are in the queue.
Thanks!
-- Steve
>
> > To cover the common case of sorting an array of pointers, Daniel
> > Wagner recently modified the library sort() to use a specific swap
> > function for size==8, in addition to the size==4 case which was
> > already handled. Since sizeof(long) is either 4 or 8,
> > ftrace_swap_ips() is redundant and we can just let sort() pick an
> > appropriate and fast swap callback.
> >
> > Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-10-01 13:34 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-09 21:27 [PATCH] trace/ftrace.c: remove redundant swap function Rasmus Villemoes
2015-09-30 19:43 ` Rasmus Villemoes
2015-10-01 13:34 ` Steven Rostedt
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®