Re: [PATCH] make __section_nr more efficient

2016-07-21 Thread Dave Hansen
On 07/20/2016 06:55 PM, zhouchengming wrote: > Thanks for your reply. I don't know the compiler will optimize the loop. > But when I see the assembly code of __section_nr, it seems to still have > the loop in it. Oh, well. I guess it got broken in the last decade or so. Your patch looks good to

Re: [PATCH] make __section_nr more efficient

2016-07-20 Thread zhouchengming
On 2016/7/21 5:36, Dave Hansen wrote: 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

Re: [PATCH] make __section_nr more efficient

2016-07-20 Thread Dave Hansen
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 beca

[PATCH] make __section_nr more efficient

2016-07-19 Thread Zhou Chengming
When CONFIG_SPARSEMEM_EXTREME is disabled, __section_nr can get the section number with a subtraction directly. Signed-off-by: Zhou Chengming --- mm/sparse.c | 12 +++- 1 files changed, 7 insertions(+), 5 deletions(-) diff --git a/mm/sparse.c b/mm/sparse.c index 5d0cf45..36d7bbb 10064