Re: [PATCH v2] lib/memweight.c: open codes bitmap_weight()

2019-09-13 Thread efremov
Sorry, no question, pointer alignment of course. Denis Efremov писал 2019-09-13 14:48: Hi, Sorry for reviving this conversation, but it looks to me like this function could be reduced to a single bitmap_weight call: static inline size_t memweight(const void *ptr, size_t bytes) {

Re: [PATCH v2] lib/memweight.c: open codes bitmap_weight()

2019-09-13 Thread Denis Efremov
Hi, Sorry for reviving this conversation, but it looks to me like this function could be reduced to a single bitmap_weight call: static inline size_t memweight(const void *ptr, size_t bytes) { BUG_ON(bytes >= UINT_MAX / BITS_PER_BYTE); return bitmap_weight(ptr, bytes *

Re: [PATCH v2] lib/memweight.c: open codes bitmap_weight()

2019-08-26 Thread Matthew Wilcox
On Sun, Aug 25, 2019 at 02:39:47PM +0300, Denis Efremov wrote: > On 25.08.2019 09:11, Matthew Wilcox wrote: > > On Sat, Aug 24, 2019 at 01:01:02PM +0300, Denis Efremov wrote: > >> This patch open codes the bitmap_weight() call. The direct > >> invocation of hweight_long() allows to remove the

Re: [PATCH v2] lib/memweight.c: open codes bitmap_weight()

2019-08-25 Thread Denis Efremov
On 25.08.2019 09:11, Matthew Wilcox wrote: > On Sat, Aug 24, 2019 at 01:01:02PM +0300, Denis Efremov wrote: >> This patch open codes the bitmap_weight() call. The direct >> invocation of hweight_long() allows to remove the BUG_ON and >> excessive "longs to bits, bits to longs" conversion. > >

Re: [PATCH v2] lib/memweight.c: open codes bitmap_weight()

2019-08-25 Thread Matthew Wilcox
On Sat, Aug 24, 2019 at 01:01:02PM +0300, Denis Efremov wrote: > This patch open codes the bitmap_weight() call. The direct > invocation of hweight_long() allows to remove the BUG_ON and > excessive "longs to bits, bits to longs" conversion. Honestly, that's not the problem with this function.

[PATCH v2] lib/memweight.c: open codes bitmap_weight()

2019-08-24 Thread Denis Efremov
This patch open codes the bitmap_weight() call. The direct invocation of hweight_long() allows to remove the BUG_ON and excessive "longs to bits, bits to longs" conversion. BUG_ON was required to check that bitmap_weight() will return a correct value, i.e. the computed weight will fit the int