Received: by 10.192.165.148 with SMTP id m20csp280825imm; Fri, 20 Apr 2018 06:44:44 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/xYc/RXF7n2chnbQyRaLQBb6A6a8QTFohd8Iqoo9HUdPjxUu4F/7Hd3Mgj0wf/yb7PDPKK X-Received: by 10.99.39.135 with SMTP id n129mr8634947pgn.167.1524231884177; Fri, 20 Apr 2018 06:44:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524231884; cv=none; d=google.com; s=arc-20160816; b=JAzP7ElQQcWgRJ7myYJld2OidG5z+U3+fGECVR+Pvg/5LeU2govdg5zP+ynBfAEEeu PgSOk1tqgaeMivduNWILJQWI/DmgcIR98QKvnyVFFSdOS/C6ukPXUovZxtQABpiui7Si xYb8wZfd7ox7c2iGeC5u7+OX60BHCMqd3x3mdwny1ku4vznRV9565Nj7WCvUbYuAvjxe pSw6m0zmL3iB8umHGjdpavjQdxMc/U5UhqzVg/dbBseCWS9+Nww/sKPKgBC5A/c6XgRi LMQ1hSonDtyQBKiJttQyVrZr+v+q3WjAlWcxZB8x1IakNPRuoMYGnjCpKHDGblO68VRN 9Khw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:spamdiagnosticmetadata :spamdiagnosticoutput:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:to:from:date :dkim-signature:arc-authentication-results; bh=48X+w9FNpbFYq4M1mEv7KKFOVR/2+2WsPV3wzi6Vpcw=; b=cxbtQAXa9tWvhRsiNpX7Ate6u8IhdLGJYwFFcbjPOxAYPy8KUVGNy17UDooUEr4prQ c+K1ISP942NZn7td6nfm3FWW8LAmPT89x5b/x2JMdbkjatKlxKHRHFaDnKu8Ipor4vZL lAdIajl5Ohe0AleRFPigjBeZtaMlaKPylrKjHlHdB5UaLKFm3eqphGixpitEUVynqZe7 jXSMZbtO8IOVWL94mjtudvzSOSJez45mF/oZEoHtwErinfoan2UjDaauJujaIL6q9ghR t0+7AKtiuhXqFsf4t26CjH/DxyJH0By+XZL5V88+5i+v/RKnesgLbPrfYrZhR3SOCpZ3 V8eQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@CAVIUMNETWORKS.onmicrosoft.com header.s=selector1-cavium-com header.b=at+SM1bp; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j65si4953219pgc.346.2018.04.20.06.44.29; Fri, 20 Apr 2018 06:44:44 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@CAVIUMNETWORKS.onmicrosoft.com header.s=selector1-cavium-com header.b=at+SM1bp; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755091AbeDTNnS (ORCPT + 99 others); Fri, 20 Apr 2018 09:43:18 -0400 Received: from mail-cys01nam02on0048.outbound.protection.outlook.com ([104.47.37.48]:7344 "EHLO NAM02-CY1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754940AbeDTNnQ (ORCPT ); Fri, 20 Apr 2018 09:43:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=48X+w9FNpbFYq4M1mEv7KKFOVR/2+2WsPV3wzi6Vpcw=; b=at+SM1bpOi1PFumQwZCQ87kwTF66St0wwmX2Sh8xa9EeUIw/P2IRmbDM2IyELh2nL0cvB2oeQy2DVWfKkCuH0ARgWXqSXbuWmA04V3vphsCxJKan8MVKDIWmSrxVSR7Jg4gvG7AP/QptpKXTzI61BuvlsMixBaC4XzcPVS+S+r4= Authentication-Results: linux-foundation.org; dkim=none (message not signed) header.d=none;linux-foundation.org; dmarc=none action=none header.from=caviumnetworks.com; Received: from localhost (176.59.47.253) by DM5PR07MB2905.namprd07.prod.outlook.com (2603:10b6:3:9::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.696.13; Fri, 20 Apr 2018 13:43:14 +0000 Date: Fri, 20 Apr 2018 16:43:05 +0300 From: Yury Norov To: Andrew Morton , Matthew Wilcox , Rasmus Villemoes , linux-kernel@vger.kernel.org Subject: Re: [PATCH] lib: micro-optimization for __bitmap_complement() Message-ID: <20180420134305.azmvwwmgi7avga7s@yury-thinkpad> References: <20180411145914.6011-1-ynorov@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180411145914.6011-1-ynorov@caviumnetworks.com> User-Agent: NeoMutt/20170609 (1.8.3) X-Originating-IP: [176.59.47.253] X-ClientProxiedBy: LNXP265CA0027.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:5c::15) To DM5PR07MB2905.namprd07.prod.outlook.com (2603:10b6:3:9::19) X-MS-PublicTrafficType: Email X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(5600026)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020);SRVR:DM5PR07MB2905; X-Microsoft-Exchange-Diagnostics: 1;DM5PR07MB2905;3:ZYk++NxfW+8LrHE5NuSYYkIPJW97zHdn2oIB4wBCG/3dtMSc9RYZAPUJU1Thkj8GHaU6i6CumWDV+J1znntDRD0Ec6A8brQdpE8IUvaq/VZ9EPvzcTzyLQQCe/bM5Czr7Vz2ADw1Y6cHyoIedSCZbZKrWWrankX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+INhC11TzfX8RiFx0fWmfuvRu6VNvBG7C7HBO/P4kEummVrr7gVXihPXYUZAP1w6QOTY6QmpyMTpfG2TWFfrae0vQWWZCJTfxd23CTmElnlHxjXapPpQrgFq3mY5j6shTJ1HypnOAjyBgS0Y9oZleGo1ws/B6QIhpTIQVuyWp6Dv/M8IsqgxFhPhxbPOME1cPyvCaGrvhEAJWoPTOCuXwqCkSTwGdNhh0DGT3IPsi7IzzkzBIfby5OJTEqdutPf1PcPjfxPXobbSLve5Dq/o7aCHPgKv93wnAX9+wie48VQ=;4:dxPLfl5SAghq+n/x/IysfktFmfbxAz14AdZSO/J9gfH5RrPo15EptQv9K3NN+OxZp0onT+8EuVdwKRpBWWDqQPX9kQ1qQinRB/sA1ubgDvDAQ46IZgxNXhQDfQJ7pvjDIa0qdv1kPpn3gNjw6C9SwrDX4J8Aw8k8J2xV9GHAIQk3xGgYminowpG6k28t/tePC/kDxAYHCPFuDE6HiH8OVmmD+jk7m19RwAvH+NCQjhG/BGeoRW9xowuLvmJa9REyY3r7VMJEajd/mlzPEq60qA== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3231232)(944501327)(52105095)(93006095)(10201501046)(3002001)(6041310)(20161123560045)(20161123564045)(20161123562045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011);SRVR:DM5PR07MB2905;BCL:0;PCL:0;RULEID:;SRVR:DM5PR07MB2905; X-Forefront-PRVS: 0648FCFFA8 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(7916004)(396003)(366004)(346002)(39860400002)(376002)(39380400002)(42882007)(3846002)(2906002)(476003)(229853002)(72206003)(8676002)(47776003)(50466002)(8936002)(81166006)(66066001)(26005)(1076002)(8666007)(305945005)(6246003)(9686003)(1511001)(16526019)(478600001)(53936002)(110136005)(11346002)(5660300001)(956004)(446003)(23726003)(76506005)(6486002)(7736002)(6116002)(33716001)(16586007)(186003)(6666003)(316002)(25786009)(59450400001)(6496006)(52116002)(76176011)(386003)(33896004);DIR:OUT;SFP:1101;SCL:1;SRVR:DM5PR07MB2905;H:localhost;FPR:;SPF:None;LANG:en;MLV:sfv; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;DM5PR07MB2905;23:ssuHZamx0KxnEoCY8XGS5cmICiBaqDjB8+9MFKPFM?= =?us-ascii?Q?tuAGoJaTd+Wr7IvcYqRWbWlMTxNcfjesx2MqODlJcBmfkjMUOaciQBqMH85f?= =?us-ascii?Q?UYkkOk8fJw/0rvk588ucjVvOp2AG4TRfn42Vgssfr39BgycN11AcWz6g0pli?= =?us-ascii?Q?tTgOEI0Ww6DyKwPQ/pZR2qr7PWJql2+yn+38RNBH7NDlBvnw/OkZadCgpvMm?= =?us-ascii?Q?Gdr6S1ohOB9Unlb/M0Reu35IyjG/mES6lbEzTNjTDMDSuFp+VD/3RH/U9Dtj?= =?us-ascii?Q?2MZWCxyggWlcAQM9gSB7VBgaSBWIX8n4RwRrjuMrYWLd8BRp21M6kTVQLLo/?= =?us-ascii?Q?YIK7II1RwiSqN3rVtVKdcMo62MYaTIVg2g5xlPMaqK6oHsGUB60GtSGWSYWG?= =?us-ascii?Q?uCApxF2MEIccMMGJhcMaHJcEci8glk0YGXpr6ARplfym9j0j0Auksd4pw9EL?= =?us-ascii?Q?zhgmMHD7U5YKY6+8F38FxdKFh+SLKJAMf5hzi8TEBK/Fe/ZyBDyixApxexSI?= =?us-ascii?Q?eXvlmVYU6RASWMy58mqbb918o7W7oIR8vfZ0FgwMbCeEZvUvOgXwXRinaKWY?= =?us-ascii?Q?255e2iymevYD56FxYhTkBkIEaMNsTHSr9jRl5mwgkC7dBYaeU02X0tSOQkkI?= =?us-ascii?Q?ksdkNzvlgZa4yQomnWBqnup/gzjK2eDCstWxhCNFzxt02tTv4YfCMGB29Nm4?= =?us-ascii?Q?r1t563HVKo+s1mTbiAXPCmxL1FAkdzdpZT+aSAt5mbshVSP2yLTXscGz4PZ4?= =?us-ascii?Q?2uVuqBIbaUo8pZ13PrGCSMkuIKWx8cc9OzuPCYQyTNBhLiFNZNSjnzI9QCRp?= =?us-ascii?Q?aNF0n83I7+ZwJM5+fWiH+Y80XbrDGvOevSsdci+rME4ge6cPVj9T1CWY2Jjc?= =?us-ascii?Q?DWxrxBEGa4GpJtYdvp/BZBnJsxnWZZhhWKVoplxtysPISUov3tlayLUYV0Ek?= =?us-ascii?Q?lgR+XlWORIlIchwVIAJfstNShNR3lvmJxQ6aGniXekNBeCVMquMej32Yqj7O?= =?us-ascii?Q?5zIzs+0k6JFiP0YqAk4liGWjG005JcJffxajpMAiqWLy+XGCcyPYABApUm88?= =?us-ascii?Q?rhqBqxPLDA8+gHEmhO44E2e4UDS6V2OprOinng4B+zp53mdI0tHOQ+oI17Qt?= =?us-ascii?Q?6nUe/4QylsRDfseppY1nxig6INi3AXk?= X-Microsoft-Antispam-Message-Info: YkyZaI7zcAMQzmRgEZHY3ZWcfIv0u9LR7WyQb9wuvlXOucc8RujzH1zlBwn63umWQj+X6haVNWPRnxsZB+AEzB28Y/ld3fSTFtU2AknG23IKAfGYiJBbAEWNTJGcsukKDUhFL6sJLrKVTARRqOw9XFq6AoDPuc9izc8DjzPjw5McTSq3zgJ2k1xQXHOIHhJW X-Microsoft-Exchange-Diagnostics: 1;DM5PR07MB2905;6:HHf6SSo5lssPldOOBEUxPrC2f64LS82jL1eeYyuIqA4d03fcgbIubd0g2HhpV9DjnIpXwGK5BzkxFWLH7+zUUy5jXXevKUHvLUc50x3T+8cCqmgsx6mWe6y/7LUj8vrDW4FUbH6hP0u0h63mEMuYSKCDi5O9Wz2tSBFTbIjkczE3i5v2sXyBH0hCz/WB9iDDQlBwgBK1XF7kfW5Uhz0f0VwnuXIqDN6FplxrMEpe6XEOlxIzt2IVUP9pLmrJJFYlsV+wXUZ6jJ3/vXv1e5Pgd6DgVZTjl9iG8+k+x4jnMjDRGxeFNrETqYpPFk1rsM4f/rcC+AfxXJYG5XHLQC66HNBWu3TyywI4xFotaoVipA+snso9pFHHs5s5ADj3zy8z7hgURDMds5FiQcBqW+DNicg1klneifs829twf1vPcMm24v0Lh5kmHpf11bUKRHu9jeq9z7utUB1MbcEajSJ6xA==;5:WYQKMrlvRgJQFfJNxFCNZq+AbCiPJK6V+o07oZckOlYbqSac8Az9/rAvLsnoSHsLfD2jDE+iHnBW2DeBCVrx9R0guCuDIJWqfA+K2UGJOhP+9VnqblJUAkvsiB0ugfh+EWgij/jIKfqICP0kI57muIjC9KPhfLMsR+NNyWb160o=;24:fn2gosU1A+19CtZEcLjccDCXtsQJ4yyvRW6EQN9Koj4Bx4BF8cMYYHsQjr8uNswT63HwGTcg3+3NadRkHIF3N2FY542NcnyuKAnZ7NUGgek= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;DM5PR07MB2905;7:Cm81aLN+5Ep+zhIvyyMrZ6TwEQBT02PI418pK+HRQz+LXzBvdc1EbzN6zHxLcNmr2p5rNT0Uv6s9HjJ7W4GL4pa3lrVYN2qlCu7GRDgJm+cSl6QnSmOgm5PSo0qUyTB5tUfqPPW1Xr0dYsdl1fGqZetGJ6MQS++MdrxQ7SK2baXIEJcqVXVf21UktHgFpahZ0RR81U7Rc6bUqoQT8E2wfLENcqutIDfOTeQLYR+J69aNl7E4BrC9O6AF0ZLkmIsm X-MS-Office365-Filtering-Correlation-Id: b21ffa16-fa22-4bbe-157a-08d5a6c4aab2 X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Apr 2018 13:43:14.5235 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b21ffa16-fa22-4bbe-157a-08d5a6c4aab2 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR07MB2905 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Ping? On Wed, Apr 11, 2018 at 05:59:14PM +0300, Yury Norov wrote: > Use BITS_TO_LONGS() macro to avoid calculation of reminder > (bits % BITS_PER_LONG) On ARM64 it saves 5 instruction for function - > 16 before and 11 after. > > Signed-off-by: Yury Norov > --- > lib/bitmap.c | 5 +---- > 1 file changed, 1 insertion(+), 4 deletions(-) > > diff --git a/lib/bitmap.c b/lib/bitmap.c > index c82c61b66e16..7adc10074cff 100644 > --- a/lib/bitmap.c > +++ b/lib/bitmap.c > @@ -62,12 +62,9 @@ EXPORT_SYMBOL(__bitmap_equal); > > void __bitmap_complement(unsigned long *dst, const unsigned long *src, unsigned int bits) > { > - unsigned int k, lim = bits/BITS_PER_LONG; > + unsigned int k, lim = BITS_TO_LONGS(bits); > for (k = 0; k < lim; ++k) > dst[k] = ~src[k]; > - > - if (bits % BITS_PER_LONG) > - dst[k] = ~src[k]; > } > EXPORT_SYMBOL(__bitmap_complement); > > -- > 2.14.1