| 1 |
.\" Copyright 2014, 2015, Michael Kerrisk <[email protected]> |
| 2 |
.\" Copyright 2024, Alejandro Colomar <[email protected]> |
| 3 |
.\" |
| 4 |
.\" SPDX-License-Identifier: Linux-man-pages-copyleft |
| 5 |
.\" |
| 6 |
.TH PR_SET_THP_DISABLE 2const 2024-06-01 "Linux man-pages 6.9.1" |
| 7 |
.SH NAME |
| 8 |
PR_SET_THP_DISABLE |
| 9 |
\- |
| 10 |
set the state of the "THP disable" flag for the calling thread |
| 11 |
.SH LIBRARY |
| 12 |
Standard C library |
| 13 |
.RI ( libc ", " \-lc ) |
| 14 |
.SH SYNOPSIS |
| 15 |
.nf |
| 16 |
.BR "#include <linux/prctl.h>" " /* Definition of " PR_* " constants */" |
| 17 |
.B #include <sys/prctl.h> |
| 18 |
.P |
| 19 |
.BI "int prctl(PR_SET_THP_DISABLE, long " flag ", 0L, 0L, 0L);" |
| 20 |
.fi |
| 21 |
.SH DESCRIPTION |
| 22 |
Set the state of the "THP disable" flag for the calling thread. |
| 23 |
If |
| 24 |
.I flag |
| 25 |
has a nonzero value, the flag is set, otherwise it is cleared. |
| 26 |
.P |
| 27 |
Setting this flag provides a method |
| 28 |
for disabling transparent huge pages |
| 29 |
for jobs where the code cannot be modified, |
| 30 |
and using a malloc hook with |
| 31 |
.BR madvise (2) |
| 32 |
is not an option (i.e., statically allocated data). |
| 33 |
The setting of the "THP disable" flag is inherited by a child created via |
| 34 |
.BR fork (2) |
| 35 |
and is preserved across |
| 36 |
.BR execve (2). |
| 37 |
.SH RETURN VALUE |
| 38 |
On success, |
| 39 |
0 is returned. |
| 40 |
On error, \-1 is returned, and |
| 41 |
.I errno |
| 42 |
is set to indicate the error. |
| 43 |
.SH STANDARDS |
| 44 |
Linux. |
| 45 |
.SH HISTORY |
| 46 |
Linux 3.15. |
| 47 |
.\" commit a0715cc22601e8830ace98366c0c2bd8da52af52 |
| 48 |
.SH SEE ALSO |
| 49 |
.BR prctl (2), |
| 50 |
.BR PR_GET_THP_DISABLE (2const) |