Re: [PATCH 3/3] mm/sparse: use __highest_present_section_nr as the boundary for pfn check
From: Wei Yang <hidden>
Date: 2018-08-24 18:11:35
On Thu, Aug 23, 2018 at 05:15:39PM -0700, Dave Hansen wrote:
On 08/23/2018 06:07 AM, Wei Yang wrote:quoted
And it is known, __highest_present_section_nr is a more strict boundary than NR_MEM_SECTIONS.What is the benefit of this patch?
The original idea is simple: with a more strict boundary, it will has less computation.
You're adding a more "strict" boundary, but you're also adding a potential cacheline miss and removing optimizations that the compiler can make with a constant vs. a variable. Providing absolute bounds limits that the compiler knows about can actually be pretty handy for it to optimize things
You are right. I haven't thought about the compiler optimization case.
Do you have *any* analysis to show that this has a benefit? What does it do to text size, for instance?
I don't have more analysis about this. Originally, I thought a strict boundary will have a benefit. But as you mentioned, it loose the compiler optimization. BTW, I did some tests and found during a normal boot, all the section number are within NR_MEM_SECTIONS. I am wondering in which case, this check will be valid and return 0? -- Wei Yang Help you, Help me