Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp1831046rda; Tue, 24 Oct 2023 04:57:08 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFJ1caZ1XDCwDy9zzfV2EO6UKrcVXP4U7hDSUo4YoozwT9ZlA+5tQ8z9/WRR1om5QIZTqCN X-Received: by 2002:a05:6a21:35c6:b0:17b:77d3:207c with SMTP id ba6-20020a056a2135c600b0017b77d3207cmr2354296pzc.17.1698148628547; Tue, 24 Oct 2023 04:57:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698148628; cv=none; d=google.com; s=arc-20160816; b=KX3+Z5i5adEdc6dJmmche1/LMh5hZT9rJpxS/Pvy3KDiuPwxkgbh/x1oX2whKM3MTJ g71DiVGs202k4twKhEzYO3TsAfcjjZAZsb3ctgLvrYuKIc3qYrblUUMdIJoJ1B8YP2Gb rh8UvkB4W2BxBRRKk76pQ3t8zI2++dt0rlSrJGheLsHTmEVtqUQnX0MNjY3wnfSzJEDR Npr6Ue1Kh04AVAeJW3JkPKhoK81SXS5Ltwzp2US0AB1kAmuGChzJDF9ak5YAVcl4ZAW4 GoYc/H5ufsgNABf34shRs5ovR4tQrcZJdUHo3ei4U0D/w7+3DZ3/7U7qzp3qqNGYLvKd ABQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=eR6QNBIHwR7YaDUpZPrEaTwM70RiKpQcsd/wVpp07CY=; fh=sz2F2aUMeQf51e4p6g+w4GkWjwhBtu4MiYgsaQc2U34=; b=CNjulf/Nsaf/ZKUdy7+z2Xz3sF12jajqwW06yWmxdNzGPEXhqAhNfGNhA7BUNydOxH tfpLdl4tpUoHYKcj4UQcp3GdxuWWQa/y3rRf1iwMsmVwCpnEF0f0rJMhEzqefe4o0zm2 82eN84uV1qz71fzWWF7kSZxkZXXostTotWjzdM08H/0xSVywUQNYaVhZt8RJ0zylFl9j 3ivu0uXANNWZCQXFs63Kmb0Yx/2oeS7+ueSvDAQD22SfO909iLd5k68/Czc9lgrw15Td F+m+ja4ljgvbX1A8FH3tLNvsEyv5Z2xl9qw8BUfKYdTzgh4SNe39mzvzAA4pVwcZYtyy Jeww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=KQQT9LGC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id ka1-20020a056a00938100b00690fc88e4acsi8595569pfb.228.2023.10.24.04.57.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Oct 2023 04:57:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=KQQT9LGC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id C795A80B0250; Tue, 24 Oct 2023 04:57:05 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232340AbjJXL5B (ORCPT + 99 others); Tue, 24 Oct 2023 07:57:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46440 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230150AbjJXL5A (ORCPT ); Tue, 24 Oct 2023 07:57:00 -0400 Received: from mail-oi1-x234.google.com (mail-oi1-x234.google.com [IPv6:2607:f8b0:4864:20::234]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C3937BD for ; Tue, 24 Oct 2023 04:56:58 -0700 (PDT) Received: by mail-oi1-x234.google.com with SMTP id 5614622812f47-3b2f4a5ccebso2961880b6e.3 for ; Tue, 24 Oct 2023 04:56:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1698148618; x=1698753418; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=eR6QNBIHwR7YaDUpZPrEaTwM70RiKpQcsd/wVpp07CY=; b=KQQT9LGC3RrHxMN5ed3pwDSSf4dWjCK9oX0vY05Q5F/PeN+q4CvVDKhc8ufYAiTmkn Dee8nxNeYgr/MyY+Y4zCK22Hq6iBDkeYBdM2bc2Iu0CJGsRTYFmQvZUB2dYQdBP4TB7q AaZ4neaCDrdjNlxtcTBnqd/KyrGi1W+V1DeDczLSUzdgMhweAzQILO2zkyR5Uvsz5tta 3ximHRGv/iDSi1sKQraAInkXIYqJ+sH/4acksXz9PAQ4MaEVncC1tkwEq9SWvbfvas9e cGxNGAopNXmg1UZXe0l5TWCjbLf8AK/OHgp635CVHgpgWiFnME7x8ZuEJFAAwjGL/9+G 60Tw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698148618; x=1698753418; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=eR6QNBIHwR7YaDUpZPrEaTwM70RiKpQcsd/wVpp07CY=; b=Gr96Xd0ZPqMTRWFpgfYlCF7GdyCXQ99Yxz+WrFq9bjvrKLziyT3CHWZxK07Fh9ABye we4NtRE50aa1nRDbFpj58E7fGb1ggpqciHlf8OtAUe2KfdrmN8L7G5Z3jOcSzKEKaW4p yK2juwUfraz79VYxE3yxiaSqqt23xnPqAkZFmm0sljh224b6G0GJwKWeJgokFbYeQtlI FbOnfFEKuq6U/llVEKHW9cVvD+EE5UIetLVXLYWIrRiWZAdAWxpocQM1N7KRLzKeYpCL bbRZMk/79gq/Bdthyva7nFGpOrNzTNG8AICmYc/kkOSjWCcNdEYlUg4mUJj0GSKmGVfb qZ5g== X-Gm-Message-State: AOJu0Yym0CFRP881Jbz7Nkch3Yhzf9vSinvpb8OEDy7EzxutwLmK6HOq yP0RKXEZOnvUV9mnC56v0GH+7ajuq4iqBsu9/t2uig== X-Received: by 2002:a05:6808:8fc:b0:3a4:3b56:72b2 with SMTP id d28-20020a05680808fc00b003a43b5672b2mr13290727oic.8.1698148617977; Tue, 24 Oct 2023 04:56:57 -0700 (PDT) MIME-Version: 1.0 References: <20231023102327.3074212-1-glider@google.com> <20231023102327.3074212-2-glider@google.com> In-Reply-To: From: Alexander Potapenko Date: Tue, 24 Oct 2023 13:56:18 +0200 Message-ID: Subject: Re: [PATCH v8 2/2] lib/test_bitmap: add tests for bitmap_{read,write}() To: Yury Norov Cc: catalin.marinas@arm.com, will@kernel.org, pcc@google.com, andreyknvl@gmail.com, andriy.shevchenko@linux.intel.com, aleksander.lobakin@intel.com, linux@rasmusvillemoes.dk, alexandru.elisei@arm.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, eugenis@google.com, syednwaris@gmail.com, william.gray@linaro.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-8.4 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Tue, 24 Oct 2023 04:57:06 -0700 (PDT) > > + > > +static void __init test_bitmap_write_perf(void) > > +{ > > + DECLARE_BITMAP(bitmap, TEST_BIT_LEN); > > + unsigned int cnt, nbits, i; > > + unsigned long val = 0xfeedface; > > + ktime_t time; > > + > > + bitmap_zero(bitmap, TEST_BIT_LEN); > > + time = ktime_get(); > > + for (cnt = 0; cnt < 5; cnt++) { > > + for (nbits = 1; nbits <= BITS_PER_LONG; nbits++) { > > + for (i = 0; i < TEST_BIT_LEN; i++) { > > + if (i + nbits > TEST_BIT_LEN) > > + break; > > + bitmap_write(bitmap, val, i, nbits); > > + } > > + } > > + } > > + time = ktime_get() - time; > > + pr_err("Time spent in %s:\t%llu\n", __func__, time); > > For the perf part, can you add the output example to the commit > message, and compare numbers with non-optimized for-loop()? > I don't understand the purpose of this comparison. It is evident that bitmap_write() is faster than the non-optimized loop doing BITS_PER_LONG reads and writes of a single bit. It is moot how much faster the current implementation is, because the loop implementation is just a concept describing the behavior of bitmap_write(). My understanding was that the performance tests will help if someone decides to optimize bitmap_write() further - in that case they would be able to compare the performance before and after their changes. But I fail to see how it helps to compare the current implementation to something that is a priori slower.