Commit a9d7ab97 authored by Dominik Dingel's avatar Dominik Dingel Committed by Martin Schwidefsky

s390/mm: use TASK_MAX_SIZE where applicable

To improve readability we can use TASK_MAX_SIZE when we just check for the
upper limit.  All places explicitly dealing with 3 vs 4 level pgtables
were left unchanged.
Signed-off-by: default avatarDominik Dingel <dingel@linux.vnet.ibm.com>
Reviewed-By: default avatarSascha Silbe <silbe@linux.vnet.ibm.com>
parent a200dcb3
...@@ -169,12 +169,12 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0, ...@@ -169,12 +169,12 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0,
int s390_mmap_check(unsigned long addr, unsigned long len, unsigned long flags) int s390_mmap_check(unsigned long addr, unsigned long len, unsigned long flags)
{ {
if (is_compat_task() || (TASK_SIZE >= (1UL << 53))) if (is_compat_task() || TASK_SIZE >= TASK_MAX_SIZE)
return 0; return 0;
if (!(flags & MAP_FIXED)) if (!(flags & MAP_FIXED))
addr = 0; addr = 0;
if ((addr + len) >= TASK_SIZE) if ((addr + len) >= TASK_SIZE)
return crst_table_upgrade(current->mm, 1UL << 53); return crst_table_upgrade(current->mm, TASK_MAX_SIZE);
return 0; return 0;
} }
...@@ -189,9 +189,9 @@ s390_get_unmapped_area(struct file *filp, unsigned long addr, ...@@ -189,9 +189,9 @@ s390_get_unmapped_area(struct file *filp, unsigned long addr,
area = arch_get_unmapped_area(filp, addr, len, pgoff, flags); area = arch_get_unmapped_area(filp, addr, len, pgoff, flags);
if (!(area & ~PAGE_MASK)) if (!(area & ~PAGE_MASK))
return area; return area;
if (area == -ENOMEM && !is_compat_task() && TASK_SIZE < (1UL << 53)) { if (area == -ENOMEM && !is_compat_task() && TASK_SIZE < TASK_MAX_SIZE) {
/* Upgrade the page table to 4 levels and retry. */ /* Upgrade the page table to 4 levels and retry. */
rc = crst_table_upgrade(mm, 1UL << 53); rc = crst_table_upgrade(mm, TASK_MAX_SIZE);
if (rc) if (rc)
return (unsigned long) rc; return (unsigned long) rc;
area = arch_get_unmapped_area(filp, addr, len, pgoff, flags); area = arch_get_unmapped_area(filp, addr, len, pgoff, flags);
...@@ -211,9 +211,9 @@ s390_get_unmapped_area_topdown(struct file *filp, const unsigned long addr, ...@@ -211,9 +211,9 @@ s390_get_unmapped_area_topdown(struct file *filp, const unsigned long addr,
area = arch_get_unmapped_area_topdown(filp, addr, len, pgoff, flags); area = arch_get_unmapped_area_topdown(filp, addr, len, pgoff, flags);
if (!(area & ~PAGE_MASK)) if (!(area & ~PAGE_MASK))
return area; return area;
if (area == -ENOMEM && !is_compat_task() && TASK_SIZE < (1UL << 53)) { if (area == -ENOMEM && !is_compat_task() && TASK_SIZE < TASK_MAX_SIZE) {
/* Upgrade the page table to 4 levels and retry. */ /* Upgrade the page table to 4 levels and retry. */
rc = crst_table_upgrade(mm, 1UL << 53); rc = crst_table_upgrade(mm, TASK_MAX_SIZE);
if (rc) if (rc)
return (unsigned long) rc; return (unsigned long) rc;
area = arch_get_unmapped_area_topdown(filp, addr, len, area = arch_get_unmapped_area_topdown(filp, addr, len,
......
...@@ -55,7 +55,7 @@ int crst_table_upgrade(struct mm_struct *mm, unsigned long limit) ...@@ -55,7 +55,7 @@ int crst_table_upgrade(struct mm_struct *mm, unsigned long limit)
unsigned long entry; unsigned long entry;
int flush; int flush;
BUG_ON(limit > (1UL << 53)); BUG_ON(limit > TASK_MAX_SIZE);
flush = 0; flush = 0;
repeat: repeat:
table = crst_table_alloc(mm); table = crst_table_alloc(mm);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment