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: Dominik Dingel <dingel@linux.vnet.ibm.com> Reviewed-By: Sascha Silbe <silbe@linux.vnet.ibm.com>
This commit is contained in:
parent
a200dcb346
commit
a9d7ab9781
|
@ -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)
|
||||
{
|
||||
if (is_compat_task() || (TASK_SIZE >= (1UL << 53)))
|
||||
if (is_compat_task() || TASK_SIZE >= TASK_MAX_SIZE)
|
||||
return 0;
|
||||
if (!(flags & MAP_FIXED))
|
||||
addr = 0;
|
||||
if ((addr + len) >= TASK_SIZE)
|
||||
return crst_table_upgrade(current->mm, 1UL << 53);
|
||||
return crst_table_upgrade(current->mm, TASK_MAX_SIZE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -189,9 +189,9 @@ s390_get_unmapped_area(struct file *filp, unsigned long addr,
|
|||
area = arch_get_unmapped_area(filp, addr, len, pgoff, flags);
|
||||
if (!(area & ~PAGE_MASK))
|
||||
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. */
|
||||
rc = crst_table_upgrade(mm, 1UL << 53);
|
||||
rc = crst_table_upgrade(mm, TASK_MAX_SIZE);
|
||||
if (rc)
|
||||
return (unsigned long) rc;
|
||||
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,
|
|||
area = arch_get_unmapped_area_topdown(filp, addr, len, pgoff, flags);
|
||||
if (!(area & ~PAGE_MASK))
|
||||
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. */
|
||||
rc = crst_table_upgrade(mm, 1UL << 53);
|
||||
rc = crst_table_upgrade(mm, TASK_MAX_SIZE);
|
||||
if (rc)
|
||||
return (unsigned long) rc;
|
||||
area = arch_get_unmapped_area_topdown(filp, addr, len,
|
||||
|
|
|
@ -55,7 +55,7 @@ int crst_table_upgrade(struct mm_struct *mm, unsigned long limit)
|
|||
unsigned long entry;
|
||||
int flush;
|
||||
|
||||
BUG_ON(limit > (1UL << 53));
|
||||
BUG_ON(limit > TASK_MAX_SIZE);
|
||||
flush = 0;
|
||||
repeat:
|
||||
table = crst_table_alloc(mm);
|
||||
|
|
Loading…
Reference in New Issue