Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1547778 > unrolled thread

[PATCH 4/8] random: remove unused branch in hot code path

Started byStephan Müller <smueller@chronox.de>
First post2016-12-27 23:50 +0100
Last post2016-12-27 23:50 +0100
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 4/8] random: remove unused branch in hot code path Stephan Müller <smueller@chronox.de> - 2016-12-27 23:50 +0100

#1547778 — [PATCH 4/8] random: remove unused branch in hot code path

FromStephan Müller <smueller@chronox.de>
Date2016-12-27 23:50 +0100
Subject[PATCH 4/8] random: remove unused branch in hot code path
Message-ID<sT8Jb-86X-5@gated-at.bofh.it>
The variable ip is defined to be a __u64 which is always 8 bytes on any
architecture. Thus, the check for sizeof(ip) > 4 will always be true.

As the check happens in a hot code path, remove the branch.

Signed-off-by: Stephan Mueller <smueller@chronox.de>
---
 drivers/char/random.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/char/random.c b/drivers/char/random.c
index 5c26b1c..8d4d720 100644
--- a/drivers/char/random.c
+++ b/drivers/char/random.c
@@ -1136,8 +1136,7 @@ void add_interrupt_randomness(int irq, int irq_flags)
 	fast_pool->pool[1] ^= now ^ c_high;
 	ip = regs ? instruction_pointer(regs) : _RET_IP_;
 	fast_pool->pool[2] ^= ip;
-	fast_pool->pool[3] ^= (sizeof(ip) > 4) ? ip >> 32 :
-		get_reg(fast_pool, regs);
+	fast_pool->pool[3] ^= ip >> 32;
 
 	fast_mix(fast_pool);
 	add_interrupt_bench(cycles);
-- 
2.9.3

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web