On Fri, 21 Jun 2019 20:24:59 +0200 David Hildenbrand <[email protected]> wrote:
> @Qian Cai, unfortunately I can't reproduce.
>
> If you get the chance, it would be great if you could retry with
>
> diff --git a/drivers/base/memory.c b/drivers/base/memory.c
> index 972c5336bebf..742f99ddd148 100644
> --- a/drivers/base/memory.c
> +++ b/drivers/base/memory.c
> @@ -868,6 +868,9 @@ int walk_memory_blocks(unsigned long start, unsigned
> long size,
> unsigned long block_id;
> int ret = 0;
>
> + if (!size)
> + return;
> +
> for (block_id = start_block_id; block_id <= end_block_id;
> block_id++) {
> mem = find_memory_block_by_id(block_id);
> if (!mem)
>
>
>
> If both, start and size are 0, we would get a veeeery long loop. This
> would mean that we have an online node that does not span any pages at
> all (pgdat->node_start_pfn = 0, start_pfn + pgdat->node_spanned_pages = 0).
I think I'll make that a `return 0' and I won't drop patches 4-6 for
now, as we appear to have this fixed.
From: David Hildenbrand <[email protected]>
Subject: drivers-base-memoryc-get-rid-of-find_memory_block_hinted-v3-fix
handle zero-length walks
Link: http://lkml.kernel.org/r/[email protected]
Reported-by: Qian Cai <[email protected]>
Tested-by: Qian Cai <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
---
drivers/base/memory.c | 3 +++
1 file changed, 3 insertions(+)
---
a/drivers/base/memory.c~drivers-base-memoryc-get-rid-of-find_memory_block_hinted-v3-fix
+++ a/drivers/base/memory.c
@@ -866,6 +866,9 @@ int walk_memory_blocks(unsigned long sta
unsigned long block_id;
int ret = 0;
+ if (!size)
+ return 0;
+
for (block_id = start_block_id; block_id <= end_block_id; block_id++) {
mem = find_memory_block_by_id(block_id);
if (!mem)