Skip to content

Commit

Permalink
mm, shmem: fix handling /sys/kernel/mm/transparent_hugepage/shmem_ena…
Browse files Browse the repository at this point in the history
…bled

/sys/kernel/mm/transparent_hugepage/shmem_enabled controls if we want
to allocate huge pages when allocate pages for private in-kernel shmem
mount.

Unfortunately, as Dan noticed, I've screwed it up and the only way to
make kernel allocate huge page for the mount is to use "force" there.
All other values will be effectively ignored.

Link: http://lkml.kernel.org/r/[email protected]
Fixes: 5a6e75f ("shmem: prepare huge= mount option and sysfs knob")
Signed-off-by: Kirill A. Shutemov <[email protected]>
Reported-by: Dan Carpenter <[email protected]>
Cc: stable <[email protected]> [4.8+]
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
kiryl authored and torvalds committed Aug 25, 2017
1 parent 556b969 commit 435c0b8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions mm/shmem.c
Original file line number Diff line number Diff line change
Expand Up @@ -3967,7 +3967,7 @@ int __init shmem_init(void)
}

#ifdef CONFIG_TRANSPARENT_HUGE_PAGECACHE
if (has_transparent_hugepage() && shmem_huge < SHMEM_HUGE_DENY)
if (has_transparent_hugepage() && shmem_huge > SHMEM_HUGE_DENY)
SHMEM_SB(shm_mnt->mnt_sb)->huge = shmem_huge;
else
shmem_huge = 0; /* just in case it was patched */
Expand Down Expand Up @@ -4028,7 +4028,7 @@ static ssize_t shmem_enabled_store(struct kobject *kobj,
return -EINVAL;

shmem_huge = huge;
if (shmem_huge < SHMEM_HUGE_DENY)
if (shmem_huge > SHMEM_HUGE_DENY)
SHMEM_SB(shm_mnt->mnt_sb)->huge = shmem_huge;
return count;
}
Expand Down

0 comments on commit 435c0b8

Please sign in to comment.