From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B56F6C4320A for ; Sat, 14 Aug 2021 22:17:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9D3C160F48 for ; Sat, 14 Aug 2021 22:17:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233507AbhHNWSI (ORCPT ); Sat, 14 Aug 2021 18:18:08 -0400 Received: from mail.kernel.org ([198.145.29.99]:58870 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233452AbhHNWSI (ORCPT ); Sat, 14 Aug 2021 18:18:08 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 926AF60EE0; Sat, 14 Aug 2021 22:17:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1628979459; bh=DBsxBPOgEGXaonNRnoyAOvLBJIUV0dCCf7xaOodseRI=; h=Date:From:To:Subject:From; b=o8UEJvA071A+hV0HgJhzu+LdErtR9543WyKv8IrIju4CPAL61cSBg3JmTRKfuWKxT FB4m0l4ZF3K1haRBWcutHY/QJ5sRbOldFueY6tYh/PhLDynV0fgHzlFu9zO9l5Q5ke lc+kRHABG8YZlS2C5toDK2NmjQcvMxkHwGeSTu3E= Date: Sat, 14 Aug 2021 15:17:39 -0700 From: akpm@linux-foundation.org To: mm-commits@vger.kernel.org, wsa+renesas@sang-engineering.com, will@kernel.org, ulf.hansson@linaro.org, lkp@intel.com, jolsa@redhat.com, dennis@kernel.org, andriy.shevchenko@linux.intel.com, alobakin@pm.me, aklimov@redhat.com, yury.norov@gmail.com Subject: + find-micro-optimize-for_each_setclear_bit.patch added to -mm tree Message-ID: <20210814221739.OTPcI%akpm@linux-foundation.org> User-Agent: s-nail v14.9.10 Precedence: bulk Reply-To: linux-kernel@vger.kernel.org List-ID: X-Mailing-List: mm-commits@vger.kernel.org The patch titled Subject: find: micro-optimize for_each_{set,clear}_bit() has been added to the -mm tree. Its filename is find-micro-optimize-for_each_setclear_bit.patch This patch should soon appear at https://ozlabs.org/~akpm/mmots/broken-out/find-micro-optimize-for_each_setclear_bit.patch and later at https://ozlabs.org/~akpm/mmotm/broken-out/find-micro-optimize-for_each_setclear_bit.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Yury Norov Subject: find: micro-optimize for_each_{set,clear}_bit() The macros iterate thru all set/clear bits in a bitmap. They search a first bit using find_first_bit(), and the rest bits using find_next_bit(). Since find_next_bit() is called shortly after find_first_bit(), we can save few lines of I-cache by not using find_first_bit(). Link: https://lkml.kernel.org/r/20210814211713.180533-12-yury.norov@gmail.com Signed-off-by: Yury Norov Tested-by: Wolfram Sang Cc: Alexander Lobakin Cc: Alexey Klimov Cc: Andy Shevchenko Cc: Dennis Zhou Cc: Jiri Olsa Cc: kernel test robot Cc: Ulf Hansson Cc: Will Deacon Signed-off-by: Andrew Morton --- include/linux/find.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/include/linux/find.h~find-micro-optimize-for_each_setclear_bit +++ a/include/linux/find.h @@ -280,7 +280,7 @@ unsigned long find_next_bit_le(const voi #endif #define for_each_set_bit(bit, addr, size) \ - for ((bit) = find_first_bit((addr), (size)); \ + for ((bit) = find_next_bit((addr), (size), 0); \ (bit) < (size); \ (bit) = find_next_bit((addr), (size), (bit) + 1)) @@ -291,7 +291,7 @@ unsigned long find_next_bit_le(const voi (bit) = find_next_bit((addr), (size), (bit) + 1)) #define for_each_clear_bit(bit, addr, size) \ - for ((bit) = find_first_zero_bit((addr), (size)); \ + for ((bit) = find_next_zero_bit((addr), (size), 0); \ (bit) < (size); \ (bit) = find_next_zero_bit((addr), (size), (bit) + 1)) _ Patches currently in -mm which might be from yury.norov@gmail.com are bitops-protect-find_first_zero_bit-properly.patch bitops-move-find_bit__le-functions-from-leh-to-findh.patch include-move-findh-from-asm_generic-to-linux.patch arch-remove-generic_find_first_bit-entirely.patch lib-add-find_first_and_bit.patch cpumask-use-find_first_and_bit.patch all-replace-find_next_zero_bit-with-find_first_zero_bit-where-appropriate.patch tools-sync-tools-bitmap-with-mother-linux.patch cpumask-replace-cpumask_next_-with-cpumask_first_-where-appropriate.patch include-linux-move-for_each_bit-macros-from-bitopsh-to-findh.patch find-micro-optimize-for_each_setclear_bit.patch replace-for_each__bit_from-with-for_each__bit-where-appropriate.patch mm-percpu-micro-optimize-pcpu_is_populated.patch bitmap-unify-find_bit-operations.patch lib-bitmap-add-performance-test-for-bitmap_print_to_pagebuf.patch vsprintf-rework-bitmap_list_string.patch