Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ee71d16d authored by Martin Schwidefsky's avatar Martin Schwidefsky
Browse files

s390/mm: make TASK_SIZE independent from the number of page table levels



The TASK_SIZE for a process should be maximum possible size of the address
space, 2GB for a 31-bit process and 8PB for a 64-bit process. The number
of page table levels required for a given memory layout is a consequence
of the mapped memory areas and their location.

Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
parent 5037c22c
Loading
Loading
Loading
Loading
+0 −4
Original line number Diff line number Diff line
@@ -8,8 +8,4 @@

#include <uapi/asm/mman.h>

#ifndef __ASSEMBLY__
int s390_mmap_check(unsigned long addr, unsigned long len, unsigned long flags);
#define arch_mmap_check(addr, len, flags) s390_mmap_check(addr, len, flags)
#endif
#endif /* __S390_MMAN_H__ */
+5 −4
Original line number Diff line number Diff line
@@ -91,14 +91,15 @@ extern void execve_tail(void);
 * User space process size: 2GB for 31 bit, 4TB or 8PT for 64 bit.
 */

#define TASK_SIZE_OF(tsk)	((tsk)->mm ? \
				 (tsk)->mm->context.asce_limit : TASK_MAX_SIZE)
#define TASK_SIZE_OF(tsk)	(test_tsk_thread_flag(tsk, TIF_31BIT) ? \
					(1UL << 31) : (1UL << 53))
#define TASK_UNMAPPED_BASE	(test_thread_flag(TIF_31BIT) ? \
					(1UL << 30) : (1UL << 41))
#define TASK_SIZE		TASK_SIZE_OF(current)
#define TASK_MAX_SIZE		(1UL << 53)
#define TASK_SIZE_MAX		(1UL << 53)

#define STACK_TOP		(1UL << (test_thread_flag(TIF_31BIT) ? 31:42))
#define STACK_TOP		(test_thread_flag(TIF_31BIT) ? \
					(1UL << 31) : (1UL << 42))
#define STACK_TOP_MAX		(1UL << 42)

#define HAVE_ARCH_PICK_MMAP_LAYOUT
+2 −2
Original line number Diff line number Diff line
@@ -1512,9 +1512,9 @@ int kvm_arch_init_vm(struct kvm *kvm, unsigned long type)
		kvm->arch.mem_limit = KVM_S390_NO_MEM_LIMIT;
	} else {
		if (sclp.hamax == U64_MAX)
			kvm->arch.mem_limit = TASK_MAX_SIZE;
			kvm->arch.mem_limit = TASK_SIZE_MAX;
		else
			kvm->arch.mem_limit = min_t(unsigned long, TASK_MAX_SIZE,
			kvm->arch.mem_limit = min_t(unsigned long, TASK_SIZE_MAX,
						    sclp.hamax + 1);
		kvm->arch.gmap = gmap_create(current->mm, kvm->arch.mem_limit - 1);
		if (!kvm->arch.gmap)
+1 −1
Original line number Diff line number Diff line
@@ -431,7 +431,7 @@ int gmap_map_segment(struct gmap *gmap, unsigned long from,
	if ((from | to | len) & (PMD_SIZE - 1))
		return -EINVAL;
	if (len == 0 || from + len < from || to + len < to ||
	    from + len - 1 > TASK_MAX_SIZE || to + len - 1 > gmap->asce_end)
	    from + len - 1 > TASK_SIZE_MAX || to + len - 1 > gmap->asce_end)
		return -EINVAL;

	flush = 0;
+1 −1
Original line number Diff line number Diff line
@@ -211,7 +211,7 @@ int __get_user_pages_fast(unsigned long start, int nr_pages, int write,
	addr = start;
	len = (unsigned long) nr_pages << PAGE_SHIFT;
	end = start + len;
	if ((end <= start) || (end > TASK_SIZE))
	if ((end <= start) || (end > mm->context.asce_limit))
		return 0;
	/*
	 * local_irq_save() doesn't prevent pagetable teardown, but does
Loading