linux-snps-arc.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: st5pub@yandex.ru (Andrey Abramov)
To: linux-snps-arc@lists.infradead.org
Subject: [PATCH v3 1/5] arch/arc: unwind.c: replace swap function with built-in one
Date: Tue, 02 Apr 2019 23:45:08 +0300	[thread overview]
Message-ID: <988881554237908@iva6-3ac3de5fcc31.qloud-c.yandex.net> (raw)
In-Reply-To: <824481554237711@sas1-23a37bc8251c.qloud-c.yandex.net>

Replace swap_eh_frame_hdr_table_entries with built-in one, because
swap_eh_frame_hdr_table_entries does a simple byte to byte swap.

Since Spectre mitigations have made indirect function calls more
expensive, and the default simple byte copies swap is implemented
without them, an "optimized" custom swap function is now
a waste of time as well as code.

Signed-off-by: Andrey Abramov <st5pub at yandex.ru>
Reviewed by: George Spelvin <lkml at sdf.org>
Acked-by: Vineet Gupta <vgupta at synopsys.com>
---
v2->v3: nothing changed

 arch/arc/kernel/unwind.c | 20 ++------------------
 1 file changed, 2 insertions(+), 18 deletions(-)

diff --git a/arch/arc/kernel/unwind.c b/arch/arc/kernel/unwind.c
index 271e9fafa479..7610fe84afea 100644
--- a/arch/arc/kernel/unwind.c
+++ b/arch/arc/kernel/unwind.c
@@ -248,20 +248,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;
-	unsigned long v;
-
-	v = e1->start;
-	e1->start = e2->start;
-	e2->start = v;
-	v = e1->fde;
-	e1->fde = e2->fde;
-	e2->fde = v;
-}
-
 static void init_unwind_hdr(struct unwind_table *table,
 			    void *(*alloc) (unsigned long))
 {
@@ -354,10 +340,8 @@ static void init_unwind_hdr(struct unwind_table *table,
 	}
 	WARN_ON(n != header->fde_count);
 
-	sort(header->table,
-	     n,
-	     sizeof(*header->table),
-	     cmp_eh_frame_hdr_table_entries, swap_eh_frame_hdr_table_entries);
+	sort(header->table, n,
+	     sizeof(*header->table), cmp_eh_frame_hdr_table_entries, NULL);
 
 	table->hdrsz = hdrSize;
 	smp_wmb();
-- 
2.21.0

  reply	other threads:[~2019-04-02 20:45 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-02 20:41 [PATCH v3 0/5] simple sort swap function improvements Andrey Abramov
2019-04-02 20:45 ` Andrey Abramov [this message]
2019-04-02 20:47 ` [PATCH v3 2/5] powerpc: module_[32|64].c: replace swap function with built-in one Andrey Abramov
2020-06-09  5:58   ` Michael Ellerman
2019-04-02 20:49 ` [PATCH v3 3/5] ocfs2: dir, refcounttree, xattr: replace swap functions " Andrey Abramov
2019-04-02 20:52 ` [PATCH v3 4/5] ubifs: find.c: replace swap function " Andrey Abramov
2019-04-02 20:55 ` [PATCH v3 5/5] Lib: sort.h: remove the size argument from the swap function Andrey Abramov
2019-04-03 11:33   ` Andy Shevchenko

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=988881554237908@iva6-3ac3de5fcc31.qloud-c.yandex.net \
    --to=st5pub@yandex.ru \
    --cc=linux-snps-arc@lists.infradead.org \
    /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).