On Thu, Jan 16, 2014 at 03:01:44PM -0600, Alex Thorlton wrote:
> This just adds a simple check to get khugepaged to behave
> appropriately when MMF_THP_DISABLE is set.
> 
> Signed-off-by: Alex Thorlton <[email protected]>
> Cc: Ingo Molnar <[email protected]>
> Cc: Peter Zijlstra <[email protected]>
> Cc: Andrew Morton <[email protected]>
> Cc: "Kirill A. Shutemov" <[email protected]>
> Cc: Benjamin Herrenschmidt <[email protected]>
> Cc: Rik van Riel <[email protected]>
> Cc: Naoya Horiguchi <[email protected]>
> Cc: Oleg Nesterov <[email protected]>
> Cc: "Eric W. Biederman" <[email protected]>
> Cc: Andy Lutomirski <[email protected]>
> Cc: Al Viro <[email protected]>
> Cc: Kees Cook <[email protected]>
> Cc: Andrea Arcangeli <[email protected]>
> Cc: [email protected]
> 
> ---
>  mm/huge_memory.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/mm/huge_memory.c b/mm/huge_memory.c
> index 9c0b172..3cfe6b4 100644
> --- a/mm/huge_memory.c
> +++ b/mm/huge_memory.c
> @@ -2049,7 +2049,8 @@ static void insert_to_mm_slots_hash(struct mm_struct 
> *mm,
>  
>  static inline int khugepaged_test_exit(struct mm_struct *mm)
>  {
> -     return atomic_read(&mm->mm_users) == 0;
> +     return atomic_read(&mm->mm_users) == 0 ||
> +            (mm->flags & MMF_THP_DISABLE_MASK);

__khugepaged_enter() has VM_BUG_ON(khugepaged_test_exit(mm)).
Do we really want to crash there if MMF_THP_DISABLE is set?

-- 
 Kirill A. Shutemov
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to