Re: [PATCH v3 0/6] mm: Further memory block device cleanups
From: Andrew Morton <akpm@linux-foundation.org>
Date: 2019-06-21 23:43:02
Also in:
linux-acpi, linux-mm, lkml
On Fri, 21 Jun 2019 20:24:59 +0200 David Hildenbrand [off-list ref] wrote:
quoted hunk ↗ jump to hunk
@Qian Cai, unfortunately I can't reproduce. If you get the chance, it would be great if you could retry withdiff --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, unsignedlong 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 <redacted> Subject: drivers-base-memoryc-get-rid-of-find_memory_block_hinted-v3-fix handle zero-length walks Link: http://lkml.kernel.org/r/1c2edc22-afd7-2211-c4c7-40e54e5007e8@redhat.com Reported-by: Qian Cai <redacted> Tested-by: Qian Cai <redacted> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> --- 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)