Documenting prctl() PR_SET_THP_DISABLE and PR_GET_THP_DISABLE

From: Michael Kerrisk
Date: Mon Apr 14 2014 - 06:15:52 EST


Alex,

Your commit a0715cc22601e8830ace98366c0c2bd8da52af52 added the prctl()
PR_SET_THP_DISABLE and PR_GET_THP_DISABLE flags.

The text below attempts to document these flags for the prctl(3).
Could you (and anyone else who is willing) please review the text
below (one or two p[ieces of which are drawn from your commit message)
to verify that it accurately reflects reality and your intent, and
that I have not missed any significant details.

DESCRIPTION
...
PR_SET_THP_DISABLE (since Linux 3.15)
Set the state of the "THP disable" flag for the calling
thread. If arg2 has a nonzero value, the flag is set,
otherwise it is cleared. Setting this flag provides a
method for disabling transparent huge pages for jobs
where the code cannot be modified, and using a malloc
hook with madvise(2) is not an option (i.e., statically
allocated data). The setting of the "THP disable" flag
is inherited by a child created via fork(2) and is preâ
served across execve(2).

PR_GET_THP_DISABLE (since Linux 3.15)
Return (via the function result) the current setting of
the "THP disable" flag for the calling thread: either 1,
if the flag is set, or 0, if it is not.
...
RETURN VALUE
On success, PR_GET_DUMPABLE, PR_GET_KEEPCAPS,
PR_GET_NO_NEW_PRIVS, PR_GET_THP_DISABLE, PR_CAPBSET_READ,
PR_GET_TIMING, PR_GET_TIMERSLACK, PR_GET_SECUREBITS,
PR_MCE_KILL_GET, and (if it returns) PR_GET_SECCOMP return the
nonnegative values described above. All other option values
return 0 on success. On error, -1 is returned, and errno is
set appropriately.
...
ERRORS
EINVAL option is PR_SET_THP_DISABLE and arg3, arg4, or arg5 is
nonzero.

EINVAL option is PR_GET_THP_DISABLE and arg2, arg3, arg4, or
arg5 is nonzero.

Thanks,

Michael



--
Michael Kerrisk Linux man-pages maintainer;
http://www.kernel.org/doc/man-pages/
Author of "The Linux Programming Interface", http://blog.man7.org/
--
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/