aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/sys.c
diff options
context:
space:
mode:
authorAndi Kleen <andi@firstfloor.org>2009-09-16 05:50:14 -0400
committerAndi Kleen <ak@linux.intel.com>2009-09-16 05:50:14 -0400
commit4db96cf077aa938b11fe7ac79ecc9b29ec00fbab (patch)
treeec196e85769159f29952e34305795b47513639a0 /kernel/sys.c
parent6746aff74da293b5fd24e5c68b870b721e86cd5f (diff)
HWPOISON: Add PR_MCE_KILL prctl to control early kill behaviour per process
This allows processes to override their early/late kill behaviour on hardware memory errors. Typically applications which are memory error aware is better of with early kill (see the error as soon as possible), all others with late kill (only see the error when the error is really impacting execution) There's a global sysctl, but this way an application can set its specific policy. We're using two bits, one to signify that the process stated its intention and that I also made the prctl future proof by enforcing the unused arguments are 0. The state is inherited to children. Note this makes us officially run out of process flags on 32bit, but the next patch can easily add another field. Manpage patch will be supplied separately. Signed-off-by: Andi Kleen <ak@linux.intel.com>
Diffstat (limited to 'kernel/sys.c')
-rw-r--r--kernel/sys.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/kernel/sys.c b/kernel/sys.c
index b3f1097c76fa..41e02eff3398 100644
--- a/kernel/sys.c
+++ b/kernel/sys.c
@@ -1528,6 +1528,28 @@ SYSCALL_DEFINE5(prctl, int, option, unsigned long, arg2, unsigned long, arg3,
1528 current->timer_slack_ns = arg2; 1528 current->timer_slack_ns = arg2;
1529 error = 0; 1529 error = 0;
1530 break; 1530 break;
1531 case PR_MCE_KILL:
1532 if (arg4 | arg5)
1533 return -EINVAL;
1534 switch (arg2) {
1535 case 0:
1536 if (arg3 != 0)
1537 return -EINVAL;
1538 current->flags &= ~PF_MCE_PROCESS;
1539 break;
1540 case 1:
1541 current->flags |= PF_MCE_PROCESS;
1542 if (arg3 != 0)
1543 current->flags |= PF_MCE_EARLY;
1544 else
1545 current->flags &= ~PF_MCE_EARLY;
1546 break;
1547 default:
1548 return -EINVAL;
1549 }
1550 error = 0;
1551 break;
1552
1531 default: 1553 default:
1532 error = -EINVAL; 1554 error = -EINVAL;
1533 break; 1555 break;