From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751734AbcFVN3M (ORCPT ); Wed, 22 Jun 2016 09:29:12 -0400 Received: from resqmta-po-07v.sys.comcast.net ([96.114.154.166]:38967 "EHLO resqmta-po-07v.sys.comcast.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751216AbcFVN3L (ORCPT ); Wed, 22 Jun 2016 09:29:11 -0400 Date: Wed, 22 Jun 2016 08:28:50 -0500 (CDT) From: Christoph Lameter X-X-Sender: cl@east.gentwo.org To: Yury Norov cc: Andrew Morton , Yury Norov , masmart@yandex.ru, linux-mm@kvack.org, linux-kernel@vger.kernel.org, enberg@kernel.org, rientjes@google.com, iamjoonsoo.kim@lge.com, linux@rasmusvillemoes.dk, Alexey Klimov Subject: Re: [PATCH] mm: slab.h: use ilog2() in kmalloc_index() In-Reply-To: <20160622005135.GA342@yury-N73SV> Message-ID: References: <1466465586-22096-1-git-send-email-yury.norov@gmail.com> <20160621145237.dae264ea5fe6b3b7f2d2d4e6@linux-foundation.org> <20160622005135.GA342@yury-N73SV> Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.