Received: by 10.223.164.202 with SMTP id h10csp383070wrb; Tue, 14 Nov 2017 03:10:28 -0800 (PST) X-Google-Smtp-Source: AGs4zMadPBLE7/qp083dZvdsQjya3fE2kwCn84iLZ7OW9D2e7T6ZicUJcp6zlelPRUtNSELv8Zmf X-Received: by 10.84.129.106 with SMTP id 97mr7955289plb.385.1510657828253; Tue, 14 Nov 2017 03:10:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510657828; cv=none; d=google.com; s=arc-20160816; b=Erud5tCu1YMtaoWvta0i2a/3TnrQcdEI4WQ/jh8RPJbf2809SMg+rbEY2XpiLrNS4O v+nrXU1/iIB9msmrfJxVdlL24o49Tp8FfIKlgHY7xRYFYZzhq9lMnhm2Atst2Iw8xcnp CbThuUkYjVtawVjCXHSP+dC7uCl78BJulyHFBHYamnW869fnGpcQxgNKT+Tb3gEd6Yxa qxRHEsrqQSz2rhyF5drpvFxo/J2/g6nfyHAqfdfecF1wvGCl58dyWPnnbPNmX1FRC1JU vIOILtWENtMnNYR5288EeU7eDCqbeDvkr1D4QjrL4ePgmDLpg7nn5DnodXWegixvrNWY yFTw== 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:cc:to:from:date :dkim-signature:arc-authentication-results; bh=8pKz3ZT2w0vToetXxUo3o9F24RKahZw1j1hIz8aLMFw=; b=0SPsdmqrlyHGyUvfPu+tGVI62A+hu+tUSoijjLubt4H2JK935yusfKv8ZcXtU8Loj3 NothvlBdLI0aS7jGo2dPn9u5JOCqsNHJcHP85kBUZ7IwIh8h36K5IrDCc6ZAmYi4uNcK OV4UCYxLLYUcI7sFI1iXDSiNqZnw5lycTuXiI+OPikqhZWtrC5CIdl9K7bhnE8Effudl /ZPAprnDJdC9JlusMZHMPSO1JL2jDaiaiTtv1bI29vj6j+YEvdNYcsAC4VL2z+Z3dnPL WqJts3eV/zs2FN5dy9Zn8QWM526izd/rmcXqvGjOT9uxydMYVKTc6ng5ZnqxUIjAyNeA yAEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@CAVIUMNETWORKS.onmicrosoft.com header.s=selector1-cavium-com header.b=NXqTb5f7; 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 p3si15864313pld.613.2017.11.14.03.10.16; Tue, 14 Nov 2017 03:10:28 -0800 (PST) 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=NXqTb5f7; 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 S1754621AbdKNK6v (ORCPT + 87 others); Tue, 14 Nov 2017 05:58:51 -0500 Received: from mail-bl2nam02on0049.outbound.protection.outlook.com ([104.47.38.49]:4769 "EHLO NAM02-BL2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752016AbdKNK6n (ORCPT ); Tue, 14 Nov 2017 05:58:43 -0500 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=8pKz3ZT2w0vToetXxUo3o9F24RKahZw1j1hIz8aLMFw=; b=NXqTb5f7alHQygiaJPK9HtNeIu0X3skqI4ESP//EkE4p49xL+qzZSPKSHRg+GysV4LZBZiZdLx0haNRuJuOtF7O2XUON+9NZoeAc/MKFN7C3oGjeL2y0t/BLtmEnrDYWNnj1NgXa2j7IlEQUl93gdOjcAOtJjZQmx0dmKkstMiM= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Yuri.Norov@cavium.com; Received: from localhost (50.233.148.156) by CY4PR0701MB3825.namprd07.prod.outlook.com (2603:10b6:910:94::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.218.12; Tue, 14 Nov 2017 10:58:40 +0000 Date: Tue, 14 Nov 2017 13:58:27 +0300 From: Yury Norov To: Michael Ellerman Cc: linux-kernel@vger.kernel.org, Alexey Dobriyan , Andrew Morton , Clement Courbet , Matthew Wilcox , Rasmus Villemoes Subject: Re: [PATCH] lib: test module for find_*_bit() functions Message-ID: <20171114105827.wjfv3ytuegmsgrn2@yury-thinkpad> References: <20171109140714.13168-1-ynorov@caviumnetworks.com> <87r2t3wx24.fsf@concordia.ellerman.id.au> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87r2t3wx24.fsf@concordia.ellerman.id.au> User-Agent: NeoMutt/20170113 (1.7.2) X-Originating-IP: [50.233.148.156] X-ClientProxiedBy: DB6PR07CA0013.eurprd07.prod.outlook.com (2603:10a6:6:2d::23) To CY4PR0701MB3825.namprd07.prod.outlook.com (2603:10b6:910:94::31) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 102dad3c-02c1-4a72-e44e-08d52b4eaa97 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001)(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(2017052603199);SRVR:CY4PR0701MB3825; X-Microsoft-Exchange-Diagnostics: 1;CY4PR0701MB3825;3:XHVw8/MC7Z/iPPSnVBv2GuuBmSARHBgRN6fbzXg9z6ZRytrsZai/LOraQ2Ue1CR5C17OmQATtiKEiB8EsqFi99zXhyf67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/MK3V02nZbP0sPXN+wDmKjl3tZsmu2bp7Ij4g8rB4m6iipPSYqxbJo/qNI1J4COziS433y74AwoYS168F8f+y69K+eqSoke6rB7PLv2sDADksmAnIk/C7vSWeENwRgkH1oTx9lEde7CR9f7HTUgV/dnJTPQzAKmm8bIfI9WBsuBx+FNtjaqxRqikoapm0uEatsrCHm3HLsxhTVb+JDQGycLrzHzeEExU4HVMYhFQlxLu91q5Vwj7dMYNMXfPp8KSnuz4ZPNNduOPXwOsDo/Z8zcDUEwBVBbbtPo8fSsaITlF9VSrggbXA+95+5+/oaSfrPXDbqQwwIwe4T4BWkSRvSVT2NA8Iq7RGnNB4ubuE=;4:ypQQH+UM9eLMz3wZwSmAMhcC3qoxXKB2mhv1QyHuCqqFV3p9Hwqj4I3aiJfQnXUqZPOFo5YEPGZPRJ6MPHRJC1DbcQR/cw7/H416FagFtG3N2jgp4SC3y3WSwrKjqYdwBTiW1UezGzR8YlBUkbItVmVHm3Fd8OvGrU6Wmo2I9HwjoRmdZR1b3r1dyo27AlrkiFVrPadL+ZMh/jfvzKpbwR6xKQkN9CEpT4u9+yF0MlFinB2v6o2xqUzdZToREkAPzBtjELE2cRUQW9p8/Fw7nQ== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(8121501046)(5005006)(10201501046)(3231022)(3002001)(93006095)(100000703101)(100105400095)(6041248)(20161123562025)(20161123558100)(20161123564025)(20161123560025)(20161123555025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:CY4PR0701MB3825;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:CY4PR0701MB3825; X-Forefront-PRVS: 04916EA04C X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(6009001)(6069001)(7916004)(376002)(346002)(199003)(189002)(24454002)(478600001)(53936002)(6496005)(6246003)(8936002)(33646002)(6486002)(58126008)(68736007)(16586007)(72206003)(54906003)(316002)(2906002)(6666003)(76506005)(105586002)(81156014)(42882006)(81166006)(8676002)(5660300001)(16526018)(189998001)(6916009)(39060400002)(106356001)(2950100002)(9686003)(4326008)(97736004)(47776003)(66066001)(305945005)(101416001)(83506002)(25786009)(1076002)(23726003)(8666007)(3846002)(33716001)(50986999)(6116002)(76176999)(50466002)(54356999)(7736002)(229853002);DIR:OUT;SFP:1101;SCL:1;SRVR:CY4PR0701MB3825;H:localhost;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;CY4PR0701MB3825;23:+2E20tFMpp8F6dBkFK3ivCpAds9MJaIDUrNw2m1?= =?us-ascii?Q?XFYrWZfkdMS9NjgZ4lM1IcXKTXVrz2wWl4RBQ4aGHf3FCGR7wpVif6ehuaRR?= =?us-ascii?Q?W+ASXUY+C1mgq7chleEdSEgTxv6iuhgV9mnZqcDtCexMNrFfw/aiQffm+zgg?= =?us-ascii?Q?nWRh5mycQYt/573WRJXB2mbqmZSbtrVyyl8bpKGsGdunYHxocV1LtdMQmXET?= =?us-ascii?Q?DhXKMBDVS61cmRWoOL5f1kKamCm53xl9+9QU26AgaI91G7dzVLm2NvzZMLga?= =?us-ascii?Q?2zoPBZxEcwz1sgk8un1ByxVQ3eZH+lcHPBbSziSLK5to7VgUFL9csxosGjJE?= =?us-ascii?Q?OmJ6oHyQuUw/PgfeY/38tPKySEUUQ9Rb7tQTIaoh0OUsc5QE4tqAn0Hfyhx4?= =?us-ascii?Q?my8Y5KBSrH1eZPgqtft97uScMfx1/1sv4XD2671rm4g4Zrz9FRixGcksS9a9?= =?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3D?= X-Microsoft-Exchange-Diagnostics: 1;CY4PR0701MB3825;6:Wn/xEUrtVVfTAZfRm7a+t0WWSeL6N8MzEWCSvBR2bvp0sMymVXrDZNAZZ3um8Vb1DlzHtYmJ0hSKxw1xXyHPYN52SmJWr4OIl9vjwQE9REJ72gJ2BAW6YC3/4lx5AnCD+9yOt4lPymduaHmxbQQW+ag/8Zb/GJ7hxqSjmDdLaqZ+6HDEV58lpedyB/Xi7DbTBYFoTrs3k0P3pUtilkLwS9mluDAdwxqAINNp5JSRoWis7gTvgg4Bs61wE+41g9/nm9mEd1+RyFNOCliskw0KaesHcfjXJoVMw1MWWCCFVITpy/KLzSpyndCNm2oD7rc+ahPe6YIRqNcsxqcAPGfDaDKv5yJx75vIdiiG91M8uFo=;5:DUAoaqwRBC8OnN9mGn6EZWYDROn0DGjvQqNOj6kDH9NqBftN5SGnCEy5AMXBRZhd8h5qrR+DVy14JIuEG8g4hHrfacgtGJsvdCB01c+O3JqROAuG9qfqZh0Sd9CMrKtX5GZpzngmWln33HnSS8GXGRor7S6+goTHtiQB7VOrbKM=;24:jsMvPT8MUr/KagaK5uFTC/QQ0sch9XU7F7YEcam0cvOiY+fW9ms6nUlewqGhOw0kidzJ58EX8wDsT4QpOeY8DdJS7SQ9VShDAxTloT8YHbY=;7:taf3+KHje4XNjVebypRE9nwjzWzCoJ3LJX1fl5hljST/5wwxrw+HHfA0nUtqcDL7AUsJPDxqAKLvzwOxak/05mCAiWUsv4Zt6y7xpEC7MORQRGfxY9sayIjwveW0nyH+P7vdj1ZaCxGFaM6RJf0WCDicFNn56BQOMtKy/+p5p8k27897DXjdeU874nYy199fu2Scf+Ggb62xrUw1u+AJnG6IjsC3rr+H7/RA5pCuq16l8EQZf5WN0xExKTqUclwv SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Nov 2017 10:58:40.0442 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 102dad3c-02c1-4a72-e44e-08d52b4eaa97 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR0701MB3825 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Michael, On Sun, Nov 12, 2017 at 10:33:55PM +1100, Michael Ellerman wrote: > Yury Norov writes: > > > find_bit functions are widely used in the kernel, including hot paths. > > This module tests performance of that functions in 2 typical scenarios: > > randomly filled bitmap with relatively equal distribution of set and > > cleared bits, and sparse bitmap which has 1 set bit for 500 cleared bits. > > > > On ThunderX machine: > > > > Start testing find_bit() with random-filled bitmap > > [1032111.632383] find_next_bit: 240043 cycles, 164062 iterations > > [1032111.647236] find_next_zero_bit: 312848 cycles, 163619 iterations > > [1032111.661585] find_last_bit: 193748 cycles, 164062 iterations > > [1032113.450517] find_first_bit: 177720874 cycles, 164062 iterations > > [1032113.462930] > > Start testing find_bit() with sparse bitmap > > [1032113.477229] find_next_bit: 3633 cycles, 656 iterations > > [1032113.494281] find_next_zero_bit: 620399 cycles, 327025 iterations > > [1032113.506723] find_last_bit: 3038 cycles, 656 iterations > > [1032113.524485] find_first_bit: 691407 cycles, 656 iterations > > Have you thought about timing it rather than using get_cycles()? > > get_cycles() has the downside that it can't be compared across different > architectures or even platforms within an architecture. This test is written to benchmark find_bit() on the same target if algorithm is changed. Comparing different architectures looks problematic anyway. Different architectures may have different clock rates, and even implementations of the function, like ARM. And many CPUs support dynamic changing of CPU speed which will directly affect time of execution. So I don't think that direct comparison of time across platforms would be informative without additional precautions. Also, other tests, like lib/interval_tree_test.c or lib/rbtree_test.c print get_cycles() where they need to estimate performance, and it looks like common practice. Do you have real usecase for it? Yury From 1584038633434998731@xxx Tue Nov 14 10:56:00 +0000 2017 X-GM-THRID: 1583597789320519869 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread