From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933936AbbI1ONt (ORCPT ); Mon, 28 Sep 2015 10:13:49 -0400 Received: from smtp-out4.electric.net ([192.162.216.195]:52352 "EHLO smtp-out4.electric.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756584AbbI1ONr convert rfc822-to-8bit (ORCPT ); Mon, 28 Sep 2015 10:13:47 -0400 From: David Laight To: "'Neil Horman'" , Denys Vlasenko CC: "David S. Miller" , Vlad Yasevich , Marcelo Ricardo Leitner , "linux-sctp@vger.kernel.org" , "netdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: RE: [PATCH v2] net: sctp: Don't use 64 kilobyte lookup table for four elements Thread-Topic: [PATCH v2] net: sctp: Don't use 64 kilobyte lookup table for four elements Thread-Index: AQHQ+fS9coWJP1VXkEmk/KIB4r2oOp5R+reA Date: Mon, 28 Sep 2015 14:12:26 +0000 Message-ID: <063D6719AE5E284EB5DD2968C1650D6D1CBA41B0@AcuExch.aculab.com> References: <1443443644-12825-1-git-send-email-dvlasenk@redhat.com> <20150928135127.GB5248@hmsreliant.think-freely.org> In-Reply-To: <20150928135127.GB5248@hmsreliant.think-freely.org> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.202.99.200] Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 X-Outbound-IP: 213.249.233.130 X-Env-From: David.Laight@ACULAB.COM X-PolicySMART: 3396946, 3397078 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Neil Horman > Sent: 28 September 2015 14:51 > On Mon, Sep 28, 2015 at 02:34:04PM +0200, Denys Vlasenko wrote: > > Seemingly innocuous sctp_trans_state_to_prio_map[] array > > is way bigger than it looks, since > > "[SCTP_UNKNOWN] = 2" expands into "[0xffff] = 2" ! > > > > This patch replaces it with switch() statement. What about just adding 1 (and masking) before indexing the array? That might require a static inline function with a local static array. Or define the array as (say) [16] and just mask the state before using it as an index? David