From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932764AbbI3Tnm (ORCPT ); Wed, 30 Sep 2015 15:43:42 -0400 Received: from mail-wi0-f176.google.com ([209.85.212.176]:35971 "EHLO mail-wi0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753755AbbI3Tnl (ORCPT ); Wed, 30 Sep 2015 15:43:41 -0400 From: Rasmus Villemoes To: Steven Rostedt Cc: Ingo Molnar , linux-kernel@vger.kernel.org Subject: Re: [PATCH] trace/ftrace.c: remove redundant swap function Organization: D03 References: <1441834023-13130-1-git-send-email-linux@rasmusvillemoes.dk> X-Hashcash: 1:20:150930:mingo@redhat.com::JOULYMDXLfapUdWq:01AIs X-Hashcash: 1:20:150930:linux-kernel@vger.kernel.org::YD6D2XyZ2Rb5yMwF:0000000000000000000000000000000001XZe X-Hashcash: 1:20:150930:rostedt@goodmis.org::JRHGZN8fepIFVen2:0000000000000000000000000000000000000000005uL4 Date: Wed, 30 Sep 2015 21:43:38 +0200 In-Reply-To: <1441834023-13130-1-git-send-email-linux@rasmusvillemoes.dk> (Rasmus Villemoes's message of "Wed, 9 Sep 2015 23:27:02 +0200") Message-ID: <87zj03elqt.fsf@rasmusvillemoes.dk> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 09 2015, Rasmus Villemoes 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 > --- > 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)