Re: [RFC PATCHv2 1/2] Add mm flag to control THP

From: Andy Lutomirski
Date: Fri Jan 17 2014 - 14:54:38 EST


On Thu, Jan 16, 2014 at 1:01 PM, Alex Thorlton <athorlton@xxxxxxx> wrote:
> This patch adds an mm flag (MMF_THP_DISABLE) to disable transparent
> hugepages using prctl.
>

> --- a/kernel/sys.c
> +++ b/kernel/sys.c
> @@ -1998,6 +1998,17 @@ SYSCALL_DEFINE5(prctl, int, option, unsigned long, arg2, unsigned long, arg3,
> if (arg2 || arg3 || arg4 || arg5)
> return -EINVAL;
> return current->no_new_privs ? 1 : 0;
> + case PR_SET_THP_DISABLE:
> + if (arg2)
> + set_bit(MMF_THP_DISABLE, &me->mm->flags);
> + else
> + clear_bit(MMF_THP_DISABLE, &me->mm->flags);
> + break;
> + case PR_GET_THP_DISABLE:
> + error = put_user(test_bit(MMF_THP_DISABLE,
> + &me->mm->flags),
> + (int __user *) arg2);
> + break;

Usual nit: please return -EINVAL if unused args are nonzero. This
makes it possible to extend these APIs in the future.

--Andy
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/