lkml.org 
[lkml]   [2019]   [Nov]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2] riscv: Use PMD_SIZE to repalce PTE_PARENT_SIZE
On Mon, Nov 04, 2019 at 06:20:12PM -0800, Zong Li wrote:
> uintptr_t map_size = PAGE_SIZE;
>
> - /* Upgrade to PMD/PGDIR mappings whenever possible */
> - if (!(base & (PTE_PARENT_SIZE - 1)) &&
> - !(size & (PTE_PARENT_SIZE - 1)))
> - map_size = PTE_PARENT_SIZE;
> + /* Upgrade to PMD_SIZE mappings whenever possible */
> + if (!(base & (PMD_SIZE - 1)) &&
> + !(size & (PMD_SIZE - 1)))
> + map_size = PMD_SIZE;

The check easily fits onto a single line now. Also the map_size
variable is rather pointless. Why not:

if ((base & (PMD_SIZE - 1) || (size & (PMD_SIZE - 1)))
return PAGE_SIZE;
return PMD_SIZE;

\
 
 \ /
  Last update: 2019-11-08 08:26    [W:0.084 / U:0.336 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site