From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755625AbcL0Wpr (ORCPT ); Tue, 27 Dec 2016 17:45:47 -0500 Received: from mail.eperm.de ([89.247.134.16]:55044 "EHLO mail.eperm.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754536AbcL0Wno (ORCPT ); Tue, 27 Dec 2016 17:43:44 -0500 From: Stephan =?ISO-8859-1?Q?M=FCller?= To: Ted Tso Cc: linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org Subject: [PATCH 4/8] random: remove unused branch in hot code path Date: Tue, 27 Dec 2016 23:40:23 +0100 Message-ID: <3380804.uZWydldqLU@positron.chronox.de> User-Agent: KMail/5.3.3 (Linux/4.8.14-300.fc25.x86_64; KDE/5.27.0; x86_64; ; ) In-Reply-To: <3254875.f5A5oHPdxF@positron.chronox.de> References: <3254875.f5A5oHPdxF@positron.chronox.de> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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