Messages in this thread | | | Date | Thu, 14 Nov 2019 16:16:38 +0800 | From | Baoquan He <> | Subject | Re: [PATCH v4 4/4] x86/mm/KASLR: Adjust the padding size for the direct mapping. |
| |
On 11/12/19 at 03:47pm, Masayoshi Mizuma wrote: > Your suggesion makes it simpler, thanks! > So I'll modify calc_direct_mapping_size() as following. > Does it make sense?
Yeah, it looks good to me. Thanks.
> > static inline unsigned long calc_direct_mapping_size(void) > { > unsigned long size_tb, memory_tb; > > memory_tb = DIV_ROUND_UP(max_pfn << PAGE_SHIFT, 1UL << TB_SHIFT) + > CONFIG_RANDOMIZE_MEMORY_PHYSICAL_PADDING; > > #ifdef CONFIG_MEMORY_HOTPLUG > if (boot_params.max_addr) { > unsigned long maximum_tb; > > maximum_tb = DIV_ROUND_UP(boot_params.max_addr, > 1UL << TB_SHIFT); > > if (maximum_tb > memory_tb) > memory_tb = maximum_tb; > } > #endif > size_tb = 1 << (MAX_PHYSMEM_BITS - TB_SHIFT); > > /* > * Adapt physical memory region size based on available memory > */ > if (memory_tb < size_tb) > size_tb = memory_tb; > > return size_tb; > }
| |