Return-path: Received: from mail-ob0-f194.google.com ([209.85.214.194]:34760 "EHLO mail-ob0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964943AbcBDPoD (ORCPT ); Thu, 4 Feb 2016 10:44:03 -0500 Subject: Re: [PATCH 1/2] rtlwifi: Fix improve function 'rtl_addr_delay()' in core.c To: David Laight , ByeoungWook Kim References: <20160203015953.GA13562@gmail.com> <063D6719AE5E284EB5DD2968C1650D6D1CCD5486@AcuExch.aculab.com> <56B258B2.6090802@lwfinger.net> <063D6719AE5E284EB5DD2968C1650D6D1CCD61C8@AcuExch.aculab.com> Cc: "kvalo@codeaurora.org" , "chaoming_li@realsil.com.cn" , "linux-wireless@vger.kernel.org" , "netdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" From: Larry Finger Message-ID: <56B371BE.1060805@lwfinger.net> (sfid-20160204_164432_482722_AAD7BBA5) Date: Thu, 4 Feb 2016 09:43:58 -0600 MIME-Version: 1.0 In-Reply-To: <063D6719AE5E284EB5DD2968C1650D6D1CCD61C8@AcuExch.aculab.com> Content-Type: text/plain; charset=utf-8; format=flowed Sender: linux-wireless-owner@vger.kernel.org List-ID: On 02/04/2016 03:48 AM, David Laight wrote: > From: Larry Finger >> Sent: 03 February 2016 19:45 > ... >> The performance will depend on where you satisfy the condition. All switch cases >> have the same execution time, but in the if .. else if .. else form, the earlier >> tests execute more quickly. I'm not sure that one can make any blanket statement >> about performance. Certainly, the switch version will be larger. For a switch >> with 8 cases plus default, the object code if 43 bytes larger than the nested >> ifs in a test program that I created. That is a significant penalty. > > There is also the penalty of the (likely) data cache miss reading the jump table. > But given this code is all about generating a variable delay the execution > speed is probably irrelevant. > > It would be much more interesting if the delay could be changed for sleeps. Unfortunately, sleeping is not possible for the routines that call rtl_addr_delay(). Larry