In kdump case, there exists only one dedicated memblock region as usable
memory (crashk_res). With this patch, kexec_walk_memblock() runs a given
callback function on this region.

Cosmetic change: 0 to MEMBLOCK_NONE at for_each_free_mem_range*()

Signed-off-by: AKASHI Takahiro <[email protected]>
Acked-by: Dave Young <[email protected]>
Cc: Vivek Goyal <[email protected]>
Cc: Baoquan He <[email protected]>
---
 kernel/kexec_file.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/kernel/kexec_file.c b/kernel/kexec_file.c
index d03195a8cb6e..f1d0e00a3971 100644
--- a/kernel/kexec_file.c
+++ b/kernel/kexec_file.c
@@ -515,8 +515,11 @@ static int kexec_walk_memblock(struct kexec_buf *kbuf,
        phys_addr_t mstart, mend;
        struct resource res = { };
 
+       if (kbuf->image->type == KEXEC_TYPE_CRASH)
+               return func(&crashk_res, kbuf);
+
        if (kbuf->top_down) {
-               for_each_free_mem_range_reverse(i, NUMA_NO_NODE, 0,
+               for_each_free_mem_range_reverse(i, NUMA_NO_NODE, MEMBLOCK_NONE,
                                                &mstart, &mend, NULL) {
                        /*
                         * In memblock, end points to the first byte after the
@@ -530,8 +533,8 @@ static int kexec_walk_memblock(struct kexec_buf *kbuf,
                                break;
                }
        } else {
-               for_each_free_mem_range(i, NUMA_NO_NODE, 0, &mstart, &mend,
-                                       NULL) {
+               for_each_free_mem_range(i, NUMA_NO_NODE, MEMBLOCK_NONE,
+                                       &mstart, &mend, NULL) {
                        /*
                         * In memblock, end points to the first byte after the
                         * range while in kexec, end points to the last byte
-- 
2.19.0


_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

Reply via email to