lkml.org 
[lkml]   [2019]   [Nov]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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;
> }

\
 
 \ /
  Last update: 2019-11-14 09:17    [W:0.401 / U:0.808 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site