From patchwork Tue Oct 5 05:40:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yury Norov X-Patchwork-Id: 12535563 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B1409C433F5 for ; Tue, 5 Oct 2021 05:41:46 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 6903161074 for ; Tue, 5 Oct 2021 05:41:46 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 6903161074 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 081096B0087; Tue, 5 Oct 2021 01:41:46 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 05BB9900002; Tue, 5 Oct 2021 01:41:46 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E3A6E6B0089; Tue, 5 Oct 2021 01:41:45 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0009.hostedemail.com [216.40.44.9]) by kanga.kvack.org (Postfix) with ESMTP id D3A7E6B0087 for ; Tue, 5 Oct 2021 01:41:45 -0400 (EDT) Received: from smtpin28.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 969EA8249980 for ; Tue, 5 Oct 2021 05:41:45 +0000 (UTC) X-FDA: 78661286970.28.D81B4AA Received: from mail-pj1-f42.google.com (mail-pj1-f42.google.com [209.85.216.42]) by imf13.hostedemail.com (Postfix) with ESMTP id 5C6491039ECF for ; Tue, 5 Oct 2021 05:41:45 +0000 (UTC) Received: by mail-pj1-f42.google.com with SMTP id oa12-20020a17090b1bcc00b0019f715462a8so1500631pjb.3 for ; Mon, 04 Oct 2021 22:41:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=nVIr7fAkmnLGTRIKArO4HwVYW8hhJ6BbGtxi7VDtm5A=; b=hOVRsOlT8XPHEFn7u90zG8kykUcqD1ypQHJ/k9TmiKzTRKuEbC/SAMidDKAKRuWDyf ONXZiigSr00bSFhT96Jcn0Zlj9HZB/o5fFhESjadfXMDEU5C5pZwwGMvrRD5rnhy1fuy 9UKf1jM/PPWmBFKY1hJx9mC5gO1MTACgmo6W1ZcR6J0IIClqU3RsXMXNgZJcBTFrHIBT eNMhetVQBRFqh0ZeNqX4I+PgrAIYpp+pfi5pXDjCnFLWOLr836YhHNSepcvhUK3aN9Ln l5nIWn+NZBNc6ZeMAF3gQGdkctCVYwr2nZPG9Wg9rnt5Zvp3zKpEWjGsgaIcY4c8SPOS WnBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=nVIr7fAkmnLGTRIKArO4HwVYW8hhJ6BbGtxi7VDtm5A=; b=pATA06aqynXHKHEbB3xhHeIKieDyGrrKhU94TOXp6zo4TGsQxf8xfArR2OPIhLCiMh sv4qeZExA44yJm70l+xegs9t8cSGPgIJF9jlzGgEzqj5E4d9MwoAbBrgFJnZs4moXNKq 46uDXwk+4M9Ivr198PCHDi7baArcSP/SaRNjaVQ+Fy5KD9TIO2kedxgTKEpm3rnZQP7M mXnmGItjEAgKwBqQkOSZaI41+an2arN3ZO+xurDRIlDVmG2pkyAadj1h0969YEMoQLe+ 4CzSJlwJydanQGpDLLQp3qy79MnpheY+SN4A0MUK+zmyK4fQBgfBpWuEWcY0Std1aAiY RazA== X-Gm-Message-State: AOAM531W5msVqxKaKazdPbojNShJqld2lcRIlG6nsY/C5vO55zFbXnUx aliJO/6xu1Kr5yjjtGORvDY= X-Google-Smtp-Source: ABdhPJwduIIdB4dTL8t+flaozTGh6Eae8ekpp/242AL8xC7zBroB9475SOuRVteNcwlN153uZIeuIg== X-Received: by 2002:a17:90b:4c86:: with SMTP id my6mr1521844pjb.77.1633412504391; Mon, 04 Oct 2021 22:41:44 -0700 (PDT) Received: from localhost (searspoint.nvidia.com. [216.228.112.21]) by smtp.gmail.com with ESMTPSA id 65sm16122052pfu.187.2021.10.04.22.41.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Oct 2021 22:41:44 -0700 (PDT) From: Yury Norov To: Stephen Rothwell Cc: Yury Norov , Andrew Morton , linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-mmc@vger.kernel.org, linux-perf-users@vger.kernel.org, kvm@vger.kernel.org, "James E.J. Bottomley" , Alexander Lobakin , Alexander Shishkin , Alexey Klimov , Andrea Merello , Andy Shevchenko , Arnaldo Carvalho de Melo , Arnd Bergmann , Ben Gardon , Benjamin Herrenschmidt , Brian Cain , Catalin Marinas , Christoph Lameter , Daniel Bristot de Oliveira , David Hildenbrand , Dennis Zhou , Geert Uytterhoeven , Heiko Carstens , Ian Rogers , Ingo Molnar , Jaegeuk Kim , Jakub Kicinski , Jiri Olsa , Joe Perches , Jonas Bonn , Leo Yan , Mark Rutland , Namhyung Kim , Palmer Dabbelt , Paolo Bonzini , Peter Xu , Peter Zijlstra , Petr Mladek , Rasmus Villemoes , Rich Felker , Samuel Mendoza-Jonas , Sean Christopherson , Sergey Senozhatsky , Shuah Khan , Stefan Kristiansson , Steven Rostedt , Tejun Heo , Thomas Bogendoerfer , Ulf Hansson , Will Deacon , Wolfram Sang , Yoshinori Sato Subject: [PATCH 15/16] lib: bitmap: add performance test for bitmap_print_to_pagebuf Date: Mon, 4 Oct 2021 22:40:58 -0700 Message-Id: <20211005054059.475634-16-yury.norov@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211005054059.475634-1-yury.norov@gmail.com> References: <20211005054059.475634-1-yury.norov@gmail.com> MIME-Version: 1.0 X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 5C6491039ECF X-Stat-Signature: p6xce6bzb1spb64n9y38z7qep9oas1oj Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=hOVRsOlT; spf=pass (imf13.hostedemail.com: domain of yury.norov@gmail.com designates 209.85.216.42 as permitted sender) smtp.mailfrom=yury.norov@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-HE-Tag: 1633412505-861722 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Functional tests for bitmap_print_to_pagebuf() are provided in lib/test_printf.c. This patch adds performance test for a case of fully set bitmap. Signed-off-by: Yury Norov Tested-by: Wolfram Sang --- lib/test_bitmap.c | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/lib/test_bitmap.c b/lib/test_bitmap.c index d33fa5a61b95..0c82f07f74fc 100644 --- a/lib/test_bitmap.c +++ b/lib/test_bitmap.c @@ -446,6 +446,42 @@ static void __init test_bitmap_parselist(void) } } +static void __init test_bitmap_printlist(void) +{ + unsigned long *bmap = kmalloc(PAGE_SIZE, GFP_KERNEL); + char *buf = kmalloc(PAGE_SIZE, GFP_KERNEL); + char expected[256]; + int ret, slen; + ktime_t time; + + if (!buf || !bmap) + goto out; + + memset(bmap, -1, PAGE_SIZE); + slen = snprintf(expected, 256, "0-%ld", PAGE_SIZE * 8 - 1); + if (slen < 0) + goto out; + + time = ktime_get(); + ret = bitmap_print_to_pagebuf(true, buf, bmap, PAGE_SIZE * 8); + time = ktime_get() - time; + + if (ret != slen + 1) { + pr_err("bitmap_print_to_pagebuf: result is %d, expected %d\n", ret, slen); + goto out; + } + + if (strncmp(buf, expected, slen)) { + pr_err("bitmap_print_to_pagebuf: result is %s, expected %s\n", buf, expected); + goto out; + } + + pr_err("bitmap_print_to_pagebuf: input is '%s', Time: %llu\n", buf, time); +out: + kfree(buf); + kfree(bmap); +} + static const unsigned long parse_test[] __initconst = { BITMAP_FROM_U64(0), BITMAP_FROM_U64(1), @@ -818,6 +854,7 @@ static void __init selftest(void) test_bitmap_arr32(); test_bitmap_parse(); test_bitmap_parselist(); + test_bitmap_printlist(); test_mem_optimisations(); test_for_each_set_clump8(); test_bitmap_cut();