From: Peter Zijlstra <peterz@infradead.org>
To: Wang Qing <wangqing@vivo.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Dennis Zhou <dennis@kernel.org>,
Wolfram Sang <wsa+renesas@sang-engineering.com>,
David Sterba <dsterba@suse.com>,
Josef Bacik <josef@toxicpanda.com>,
Stefano Brivio <sbrivio@redhat.com>,
Thomas Gleixner <tglx@linutronix.de>,
William Breathitt Gray <vilhelm.gray@gmail.com>,
Randy Dunlap <rdunlap@infradead.org>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Yury Norov <yury.norov@gmail.com>,
linux-kernel@vger.kernel.org, opensource.kernel@vivo.com
Subject: Re: [PATCH] Bitmap: Optimized division operation to shift operation
Date: Wed, 15 Apr 2020 10:56:34 +0200 [thread overview]
Message-ID: <20200415085634.GA17091@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <1586935667-4792-1-git-send-email-wangqing@vivo.com>
On Wed, Apr 15, 2020 at 03:27:40PM +0800, Wang Qing wrote:
> On some processors, the / operate will call the compiler`s div lib,
> which is low efficient. Bitmap is performance sensitive, We can
> replace the / operation with shift.
>
> Signed-off-by: Wang Qing <wangqing@vivo.com>
> ---
> include/linux/bitmap.h | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/include/linux/bitmap.h b/include/linux/bitmap.h
> index 99058eb..85ff982 100644
> --- a/include/linux/bitmap.h
> +++ b/include/linux/bitmap.h
> @@ -337,7 +337,7 @@ static inline int bitmap_equal(const unsigned long *src1,
> return !((*src1 ^ *src2) & BITMAP_LAST_WORD_MASK(nbits));
> if (__builtin_constant_p(nbits & BITMAP_MEM_MASK) &&
> IS_ALIGNED(nbits, BITMAP_MEM_ALIGNMENT))
> - return !memcmp(src1, src2, nbits / 8);
> + return !memcmp(src1, src2, nbits >> 3);
> return __bitmap_equal(src1, src2, nbits);
> }
If your compiler gets this wrong, set it on fire and scatter its remains.
prev parent reply other threads:[~2020-04-15 8:57 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-15 7:27 Wang Qing
2020-04-15 7:47 ` Joe Perches
2020-04-15 8:56 ` Peter Zijlstra [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200415085634.GA17091@hirez.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=akpm@linux-foundation.org \
--cc=andriy.shevchenko@linux.intel.com \
--cc=dennis@kernel.org \
--cc=dsterba@suse.com \
--cc=josef@toxicpanda.com \
--cc=linux-kernel@vger.kernel.org \
--cc=opensource.kernel@vivo.com \
--cc=rdunlap@infradead.org \
--cc=sbrivio@redhat.com \
--cc=tglx@linutronix.de \
--cc=vilhelm.gray@gmail.com \
--cc=wangqing@vivo.com \
--cc=wsa+renesas@sang-engineering.com \
--cc=yury.norov@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®