From 35b36c2d33835255e4da39e3e19aaf8a19f7b6d6 Mon Sep 17 00:00:00 2001 From: Balazs Gerofi Date: Wed, 17 May 2017 02:17:04 +0900 Subject: [PATCH] move_pages_smp_handler(): more parallelization --- kernel/syscall.c | 40 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/kernel/syscall.c b/kernel/syscall.c index 83df6ce2..f5163e19 100644 --- a/kernel/syscall.c +++ b/kernel/syscall.c @@ -8178,7 +8178,7 @@ int move_pages_smp_handler(int cpu_index, int nr_cpus, void *arg) break; } } - else if (nr_cpus >= 4) { + else if (nr_cpus >= 4 && nr_cpus < 8) { switch (cpu_index) { case 0: memcpy(mpsr->virt_addr, mpsr->user_virt_addr, @@ -8205,6 +8205,44 @@ int move_pages_smp_handler(int cpu_index, int nr_cpus, void *arg) break; } } + else if (nr_cpus >= 8) { + switch (cpu_index) { + case 0: + memcpy(mpsr->virt_addr, mpsr->user_virt_addr, + sizeof(void *) * (count / 2)); + break; + case 1: + memcpy(mpsr->virt_addr + (count / 2), + mpsr->user_virt_addr + (count / 2), + sizeof(void *) * (count / 2)); + break; + case 2: + memcpy(mpsr->status, mpsr->user_status, + sizeof(int) * count); + break; + case 3: + memcpy(mpsr->nodes, mpsr->user_nodes, + sizeof(int) * count); + mpsr->nodes_ready = 1; + break; + case 4: + memset(mpsr->ptep, 0, sizeof(pte_t) * count); + break; + case 5: + memset(mpsr->status, 0, sizeof(int) * count); + break; + case 6: + memset(mpsr->nr_pages, 0, sizeof(int) * count); + break; + case 7: + memset(mpsr->dst_phys, 0, + sizeof(unsigned long) * count); + break; + + default: + break; + } + } while (!(volatile int)mpsr->nodes_ready) { cpu_pause();