lkml.org 
[lkml]   [2016]   [Dec]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH V3 1/2] mm/memblock.c: trivial code refine in memblock_is_region_memory()
On Wed 21-12-16 23:30:32, Wei Yang wrote:
> memblock_is_region_memory() invoke memblock_search() to see whether the
> base address is in the memory region. If it fails, idx would be -1. Then,
> it returns 0.
>
> If the memblock_search() returns a valid index, it means the base address
> is guaranteed to be in the range memblock.memory.regions[idx]. Because of
> this, it is not necessary to check the base again.
>
> This patch removes the check on "base".

OK, the patch looks correct. I doubt it makes any real difference but I
do not see it being harmful.

> Signed-off-by: Wei Yang <richard.weiyang@gmail.com>

Acked-by: Michal Hocko <mhocko@suse.com>

> ---
> mm/memblock.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/mm/memblock.c b/mm/memblock.c
> index 7608bc3..4929e06 100644
> --- a/mm/memblock.c
> +++ b/mm/memblock.c
> @@ -1615,8 +1615,7 @@ int __init_memblock memblock_is_region_memory(phys_addr_t base, phys_addr_t size
>
> if (idx == -1)
> return 0;
> - return memblock.memory.regions[idx].base <= base &&
> - (memblock.memory.regions[idx].base +
> + return (memblock.memory.regions[idx].base +
> memblock.memory.regions[idx].size) >= end;
> }
>
> --
> 2.5.0

--
Michal Hocko
SUSE Labs

\
 
 \ /
  Last update: 2016-12-22 10:07    [W:3.507 / U:0.920 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site