Skip to content

Commit 32bec6b

Browse files
committed
mm/mempolicy: Add override to force numa policy
Some apps like linpack call numa_setpolicy to disable numa, but that tends to have a significant performance hit for us. Add an option to force the default numa mode (and so ignore policy changes) for now. Consider making this the default behaviour in the future. Use mempolicy.force_numa=1 in cmdline.txt or echo 1 | sudo tee /sys/module/mempolicy/parameters/force_numa to force the default numa policy. Signed-off-by: Dom Cobley <[email protected]>
1 parent 8d53a07 commit 32bec6b

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

mm/mempolicy.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,10 @@
119119

120120
#include "internal.h"
121121

122+
/* When true, this forces the default numa policy and igores requests to change */
123+
static bool force_numa;
124+
module_param(force_numa, bool, 0644);
125+
122126
/* Internal flags */
123127
#define MPOL_MF_DISCONTIG_OK (MPOL_MF_INTERNAL << 0) /* Skip checks for continuous vmas */
124128
#define MPOL_MF_INVERT (MPOL_MF_INTERNAL << 1) /* Invert check for nodemask */
@@ -1629,6 +1633,13 @@ static long kernel_set_mempolicy(int mode, const unsigned long __user *nmask,
16291633
int err;
16301634

16311635
err = sanitize_mpol_flags(&lmode, &mode_flags);
1636+
1637+
if (force_numa) {
1638+
pr_info("Request to set policy ignored (mode:%x lmode:%x flags:%x err:%d)\n",
1639+
mode, lmode, mode_flags, err);
1640+
return 0;
1641+
}
1642+
16321643
if (err)
16331644
return err;
16341645

0 commit comments

Comments
 (0)