Commit 3089bf61 authored by Toshi Kani's avatar Toshi Kani Committed by Linus Torvalds

shmem: fix tmpfs to handle the huge= option properly

shmem_get_unmapped_area() checks SHMEM_SB(sb)->huge incorrectly, which
leads to a reversed effect of "huge=" mount option.

Fix the check in shmem_get_unmapped_area().

Note, the default value of SHMEM_SB(sb)->huge remains as
SHMEM_HUGE_NEVER.  User will need to specify "huge=" option to enable
huge page mappings.
Reported-by: default avatarHillf Danton <hillf.zj@alibaba-inc.com>
Signed-off-by: default avatarToshi Kani <toshi.kani@hpe.com>
Acked-by: default avatarKirill A. Shutemov <kirill.shutemov@linux.intel.com>
Reviewed-by: default avatarAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: default avatarHugh Dickins <hughd@google.com>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 3be79886
...@@ -1980,7 +1980,7 @@ unsigned long shmem_get_unmapped_area(struct file *file, ...@@ -1980,7 +1980,7 @@ unsigned long shmem_get_unmapped_area(struct file *file,
return addr; return addr;
sb = shm_mnt->mnt_sb; sb = shm_mnt->mnt_sb;
} }
if (SHMEM_SB(sb)->huge != SHMEM_HUGE_NEVER) if (SHMEM_SB(sb)->huge == SHMEM_HUGE_NEVER)
return addr; return addr;
} }
......
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