[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <578FEEC4.9060209@intel.com>
Date: Wed, 20 Jul 2016 14:36:04 -0700
From: Dave Hansen <dave.hansen@...el.com>
To: Zhou Chengming <zhouchengming1@...wei.com>,
linux-kernel@...r.kernel.org, linux-mm@...ck.org
Cc: akpm@...ux-foundation.org, tj@...nel.org, guohanjun@...wei.com,
huawei.libin@...wei.com
Subject: Re: [PATCH] make __section_nr more efficient
On 07/19/2016 09:18 PM, Zhou Chengming wrote:
> When CONFIG_SPARSEMEM_EXTREME is disabled, __section_nr can get
> the section number with a subtraction directly.
Does this actually *do* anything?
It was a long time ago, but if I remember correctly, the entire loop in
__section_nr() goes away because root_nr==NR_SECTION_ROOTS, so
root_nr=1, and the compiler optimizes away the entire subtraction.
So this basically adds an #ifdef and gets us nothing, although it makes
the situation much more explicit. Perhaps the comment should say that
this works *and* is efficient because the compiler can optimize all the
extreme complexity away.
Powered by blists - more mailing lists