Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1428788

Re: [PATCH] mm: slab.h: use ilog2() in kmalloc_index()

From Christoph Lameter <cl@linux.com>
Newsgroups linux.kernel
Subject Re: [PATCH] mm: slab.h: use ilog2() in kmalloc_index()
Date 2016-06-22 15:30 +0200
Message-ID <rMQoa-41d-27@gated-at.bofh.it> (permalink)
References <rMh74-6ol-41@gated-at.bofh.it> <rMC1Q-3dH-13@gated-at.bofh.it> <rMQoa-41d-29@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Wed, 22 Jun 2016, Yury Norov wrote:

>
> There will be no fls() for constant at runtime because ilog2() calculates
> constant values at compile-time as well. From this point of view,
> this patch removes code duplication, as we already have compile-time
> log() calculation in kernel, and should re-use it whenever possible.\

The reason not to use ilog there was that the constant folding did not
work correctly with one or the other architectures/compilers. If you want
to do this then please verify that all arches reliably do produce a
constant there.

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH] mm: slab.h: use ilog2() in kmalloc_index() Yury Norov <yury.norov@gmail.com> - 2016-06-21 01:50 +0200
  Re: [PATCH] mm: slab.h: use ilog2() in kmalloc_index() Andrew Morton <akpm@linux-foundation.org> - 2016-06-22 00:10 +0200
    Re: [PATCH] mm: slab.h: use ilog2() in kmalloc_index() Christoph Lameter <cl@linux.com> - 2016-06-22 15:30 +0200

csiph-web