All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yury Norov <yury.norov@gmail.com>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: linux-m68k <linux-m68k@lists.linux-m68k.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Linux-SH <linux-sh@vger.kernel.org>,
	Linux-Arch <linux-arch@vger.kernel.org>,
	Geert Uytterhoeven <geert@linux-m68k.org>,
	Yoshinori Sato <ysato@users.sourceforge.jp>,
	Rich Felker <dalias@libc.org>, Arnd Bergmann <arnd@arndb.de>,
	Dennis Zhou <dennis@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Wolfram Sang <wsa+renesas@sang-engineering.com>,
	David Sterba <dsterba@suse.com>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Stefano Brivio <sbrivio@redhat.com>,
	"Ma, Jianpeng" <jianpeng.ma@intel.com>,
	Wei Yang <richard.weiyang@linux.alibaba.com>,
	Josh Poimboeuf <jpoimboe@redhat.com>,
	John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Subject: Re: [PATCH 2/5] bits_per_long.h: introduce SMALL_CONST() macro
Date: Fri, 29 Jan 2021 13:28:20 -0800	[thread overview]
Message-ID: <CAAH8bW_Gt+0bC=S2HtR_B3cH-KGJQQaUQ0z0xn=aZCtBzy43yQ@mail.gmail.com> (raw)
In-Reply-To: <CAHp75VcSc=myrcvyBOkaUDguR6aPjJAFFXi2iSvmU21+1664Hw@mail.gmail.com>

On Fri, Jan 29, 2021 at 1:11 PM Andy Shevchenko
<andy.shevchenko@gmail.com> wrote:
>
> On Fri, Jan 29, 2021 at 10:49 PM Yury Norov <yury.norov@gmail.com> wrote:
> >
> > Many algorithms become simplier if they are passed with relatively small
>
> simpler
>
> > input values. One example is bitmap operations when the whole bitmap fits
> > into one word. To implement such simplifications, linux/bitmap.h declares
> > small_const_nbits() macro.
> >
> > Other subsystems may also benefit from optimizations of this sort, like
> > find_bit API in the following patches. So it looks helpful to generalize
> > the macro and extend it's visibility.
>
> > It should probably go to linux/kernel.h, but doing that creates circular
> > dependencies. So put it in asm-generic/bitsperlong.h.
>
> No, no, please leave kernel.h alone. It's already quite a mess.
>
> And this shouldn't be in the commit message either.
>
> ...
>
> > -       if (small_const_nbits(nbits))
> > +       if (SMALL_CONST(nbits - 1))
>
> Not sure if we need to rename it.

Lower case for generic macro kind of breaking the rules.

Behaviour has changed too. Before it was:
0 < VAL <= 32
Now it's
0 <= VAL < 32
Which is better for generic macro.

So changing the name looks reasonable to me.

> ...
>
> > --- a/include/linux/bits.h
> > +++ b/include/linux/bits.h
> > @@ -37,7 +37,7 @@
> >  #define GENMASK(h, l) \
> >         (GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l))
> >
> > -#define BITS_FIRST(nr)         GENMASK(nr), 0)
> > +#define BITS_FIRST(nr)         GENMASK((nr), 0)
>
> How come?!

git send-email wrong_dir/000*
Will resubmit today later.

> ...
>
> > diff --git a/tools/include/asm-generic/bitsperlong.h b/tools/include/asm-generic/bitsperlong.h
> > index 8f2283052333..432d272baf27 100644
> > --- a/tools/include/asm-generic/bitsperlong.h
> > +++ b/tools/include/asm-generic/bitsperlong.h
>
> I think a tools update would be better to have in a separate patch.
>
> --
> With Best Regards,
> Andy Shevchenko

  parent reply	other threads:[~2021-01-29 21:30 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-29 20:45 [PATCH 0/6] lib/find_bit: fast path for small bitmaps Yury Norov
2021-01-29 20:45 ` [PATCH 1/6] arch: rearrange headers inclusion order in asm/bitops for m68k and sh Yury Norov
2021-01-29 20:45 ` [PATCH 2/6] lib: inttroduce BITS_{FIRST,LAST}() macro Yury Norov
2021-01-29 20:45 ` [PATCH 2/5] bits_per_long.h: introduce SMALL_CONST() macro Yury Norov
2021-01-29 21:10   ` Andy Shevchenko
2021-01-29 21:24     ` Joe Perches
2021-01-29 21:28     ` Yury Norov [this message]
2021-01-29 22:25     ` Yury Norov
2021-01-29 20:45 ` [PATCH 3/5] lib: inline _find_next_bit() wrappers Yury Norov
2021-01-29 20:45 ` [PATCH 4/5] lib: add fast path for find_next_*_bit() Yury Norov
2021-01-29 20:45 ` [PATCH 6/6] lib: add fast path for find_first_*_bit() and find_last_bit() Yury Norov
2021-01-29 20:51 ` [PATCH 0/6] lib/find_bit: fast path for small bitmaps Yury Norov
2021-01-29 21:12   ` Andy Shevchenko

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='CAAH8bW_Gt+0bC=S2HtR_B3cH-KGJQQaUQ0z0xn=aZCtBzy43yQ@mail.gmail.com' \
    --to=yury.norov@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=arnd@arndb.de \
    --cc=dalias@libc.org \
    --cc=dennis@kernel.org \
    --cc=dsterba@suse.com \
    --cc=geert@linux-m68k.org \
    --cc=glaubitz@physik.fu-berlin.de \
    --cc=jianpeng.ma@intel.com \
    --cc=jpoimboe@redhat.com \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-m68k@lists.linux-m68k.org \
    --cc=linux-sh@vger.kernel.org \
    --cc=richard.weiyang@linux.alibaba.com \
    --cc=sbrivio@redhat.com \
    --cc=wsa+renesas@sang-engineering.com \
    --cc=ysato@users.sourceforge.jp \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.