linux-snps-arc.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Vineet Gupta <vineet.gupta@linux.dev>
To: Yu-Chun Lin <eleanor15x@gmail.com>, vgupta@kernel.org
Cc: linux-snps-arc@lists.infradead.org, linux-kernel@vger.kernel.org,
	jserv@ccns.ncku.edu.tw, visitorckw@gmail.com
Subject: Re: [PATCH] ARC: unwind: Use built-in sort swap to reduce code size and improve performance
Date: Sun, 27 Apr 2025 19:37:15 -0700	[thread overview]
Message-ID: <2cd68d9e-bfa8-4b45-a153-c836a0ab7ac8@linux.dev> (raw)
In-Reply-To: <20250409171116.550665-1-eleanor15x@gmail.com>

On 4/9/25 10:11, Yu-Chun Lin wrote:
> The custom swap function used in sort() was identical to the default
> built-in sort swap. Remove the custom swap function and passes NULL to
> sort(), allowing it to use the default swap function.
>
> This change reduces code size and improves performance, particularly when
> CONFIG_MITIGATION_RETPOLINE is enabled. With RETPOLINE mitigation, indirect
> function calls incur significant overhead, and using the default swap
> function avoids this cost.
>
> $ ./scripts/bloat-o-meter ./unwind.o.old ./unwind.o.new
> add/remove: 0/1 grow/shrink: 0/1 up/down: 0/-22 (-22)
> Function                                     old     new   delta
> init_unwind_hdr.constprop                    544     540      -4
> swap_eh_frame_hdr_table_entries               18       -     -18
> Total: Before=4410, After=4388, chg -0.50%
>
> Signed-off-by: Yu-Chun Lin <eleanor15x@gmail.com>

Acked-by: Vineet Gupta <vgupta@kernel.org>

Added to for-curr.

Thx,
-Vineet

> ---
> Compile test only
>
>  arch/arc/kernel/unwind.c | 11 +----------
>  1 file changed, 1 insertion(+), 10 deletions(-)
>
> diff --git a/arch/arc/kernel/unwind.c b/arch/arc/kernel/unwind.c
> index d8969dab12d4..789cfb9ea14e 100644
> --- a/arch/arc/kernel/unwind.c
> +++ b/arch/arc/kernel/unwind.c
> @@ -241,15 +241,6 @@ static int cmp_eh_frame_hdr_table_entries(const void *p1, const void *p2)
>  	return (e1->start > e2->start) - (e1->start < e2->start);
>  }
>  
> -static void swap_eh_frame_hdr_table_entries(void *p1, void *p2, int size)
> -{
> -	struct eh_frame_hdr_table_entry *e1 = p1;
> -	struct eh_frame_hdr_table_entry *e2 = p2;
> -
> -	swap(e1->start, e2->start);
> -	swap(e1->fde, e2->fde);
> -}
> -
>  static void init_unwind_hdr(struct unwind_table *table,
>  			    void *(*alloc) (unsigned long))
>  {
> @@ -345,7 +336,7 @@ static void init_unwind_hdr(struct unwind_table *table,
>  	sort(header->table,
>  	     n,
>  	     sizeof(*header->table),
> -	     cmp_eh_frame_hdr_table_entries, swap_eh_frame_hdr_table_entries);
> +	     cmp_eh_frame_hdr_table_entries, NULL);
>  
>  	table->hdrsz = hdrSize;
>  	smp_wmb();


_______________________________________________
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc

      reply	other threads:[~2025-04-28  2:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-09 17:11 [PATCH] ARC: unwind: Use built-in sort swap to reduce code size and improve performance Yu-Chun Lin
2025-04-28  2:37 ` Vineet Gupta [this message]

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=2cd68d9e-bfa8-4b45-a153-c836a0ab7ac8@linux.dev \
    --to=vineet.gupta@linux.dev \
    --cc=eleanor15x@gmail.com \
    --cc=jserv@ccns.ncku.edu.tw \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-snps-arc@lists.infradead.org \
    --cc=vgupta@kernel.org \
    --cc=visitorckw@gmail.com \
    /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;
as well as URLs for NNTP newsgroup(s).