Skip to content

Commit

Permalink
thp: use khugepaged_enabled to remove duplicate code
Browse files Browse the repository at this point in the history
Use khugepaged_enabled to see whether thp is enabled

Signed-off-by: Xiao Guangrong <[email protected]>
Cc: Andrea Arcangeli <[email protected]>
Cc: Hugh Dickins <[email protected]>
Cc: David Rientjes <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Xiao Guangrong authored and torvalds committed Oct 9, 2012
1 parent b723178 commit 17c230a
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions mm/huge_memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,7 @@ static int set_recommended_min_free_kbytes(void)
unsigned long recommended_min;
extern int min_free_kbytes;

if (!test_bit(TRANSPARENT_HUGEPAGE_FLAG,
&transparent_hugepage_flags) &&
!test_bit(TRANSPARENT_HUGEPAGE_REQ_MADV_FLAG,
&transparent_hugepage_flags))
if (!khugepaged_enabled())
return 0;

for_each_populated_zone(zone)
Expand Down Expand Up @@ -228,11 +225,7 @@ static ssize_t enabled_store(struct kobject *kobj,
ret = err;
}

if (ret > 0 &&
(test_bit(TRANSPARENT_HUGEPAGE_FLAG,
&transparent_hugepage_flags) ||
test_bit(TRANSPARENT_HUGEPAGE_REQ_MADV_FLAG,
&transparent_hugepage_flags)))
if (ret > 0 && khugepaged_enabled())
set_recommended_min_free_kbytes();

return ret;
Expand Down

0 comments on commit 17c230a

Please sign in to comment.