[CRIU] [PATCH] Expand task_size variable for AArch32

Artem Kuzmitskiy artem.kuzmitskiy at gmail.com
Sun Nov 8 23:49:31 PST 2015


Task size depends from VM_SPLIT_* kernel option and cannot be hard coded.
This patch based on c0c0546c31e6df4932669f4740197bb830a24c8d from
Christopher Covington.

Signed-off-by: Artem Kuzmitskiy <artem.kuzmitskiy at lge.com>
---
 arch/arm/include/asm/types.h | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/arch/arm/include/asm/types.h b/arch/arm/include/asm/types.h
index 915db61..d1d6cc3 100644
--- a/arch/arm/include/asm/types.h
+++ b/arch/arm/include/asm/types.h
@@ -96,9 +96,27 @@ struct user_vfp_exc {
 #define REG_IP(regs)  ((regs).ARM_pc)
 #define REG_SYSCALL_NR(regs) ((regs).ARM_r7)
 
-#define TASK_SIZE 0xbf000000
+/*
+ * Range for task size calculated from the following Linux kernel files:
+ *   arch/arm/include/asm/memory.h
+ *   arch/arm/Kconfig (PAGE_OFFSET values in Memory split section)
+ */
+#define TASK_SIZE_MIN 0x3f000000
+#define TASK_SIZE_MAX 0xbf000000
+#define SZ_1G 0x40000000
 
-static inline unsigned long task_size() { return TASK_SIZE; }
+int munmap(void *addr, size_t length);
+
+static inline unsigned long task_size(void)
+{
+	unsigned long task_size;
+
+	for (task_size = TASK_SIZE_MIN; task_size < TASK_SIZE_MAX; task_size += SZ_1G)
+		if (munmap((void *)task_size, page_size()))
+			break;
+
+	return task_size;
+}
 
 #define AT_VECTOR_SIZE 40
 
-- 
2.6.2



More information about the CRIU mailing list