From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752483AbcAFSsx (ORCPT ); Wed, 6 Jan 2016 13:48:53 -0500 Received: from terminus.zytor.com ([198.137.202.10]:54632 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752407AbcAFSsw (ORCPT ); Wed, 6 Jan 2016 13:48:52 -0500 Date: Wed, 6 Jan 2016 10:48:15 -0800 From: tip-bot for Peter Zijlstra Message-ID: Cc: tglx@linutronix.de, tj@kernel.org, hpa@zytor.com, sasha.levin@oracle.com, torvalds@linux-foundation.org, mingo@kernel.org, peterz@infradead.org, dvyukov@google.com, linux-kernel@vger.kernel.org Reply-To: linux-kernel@vger.kernel.org, dvyukov@google.com, mingo@kernel.org, peterz@infradead.org, sasha.levin@oracle.com, torvalds@linux-foundation.org, hpa@zytor.com, tglx@linutronix.de, tj@kernel.org In-Reply-To: <20151125150207.GM11639@twins.programming.kicks-ass.net> References: <20151125150207.GM11639@twins.programming.kicks-ass.net> To: linux-tip-commits@vger.kernel.org Subject: [tip:sched/core] sched/core: Fix unserialized r-m-w scribbling stuff Git-Commit-ID: be958bdc96f18bc1356177bbb79d46ea0c037b96 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: be958bdc96f18bc1356177bbb79d46ea0c037b96 Gitweb: http://git.kernel.org/tip/be958bdc96f18bc1356177bbb79d46ea0c037b96 Author: Peter Zijlstra AuthorDate: Wed, 25 Nov 2015 16:02:07 +0100 Committer: Ingo Molnar CommitDate: Wed, 6 Jan 2016 11:01:07 +0100 sched/core: Fix unserialized r-m-w scribbling stuff Some of the sched bitfieds (notably sched_reset_on_fork) can be set on other than current, this can cause the r-m-w to race with other updates. Since all the sched bits are serialized by scheduler locks, pull them in a separate word. Reported-by: Tejun Heo Signed-off-by: Peter Zijlstra (Intel) Cc: Dmitry Vyukov Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Sasha Levin Cc: Thomas Gleixner Cc: akpm@linux-foundation.org Cc: hannes@cmpxchg.org Cc: mhocko@kernel.org Cc: vdavydov@parallels.com Link: http://lkml.kernel.org/r/20151125150207.GM11639@twins.programming.kicks-ass.net Signed-off-by: Ingo Molnar --- include/linux/sched.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/include/linux/sched.h b/include/linux/sched.h index 9cf9dd1..fa39434 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -1455,14 +1455,15 @@ struct task_struct { /* Used for emulating ABI behavior of previous Linux versions */ unsigned int personality; - unsigned in_execve:1; /* Tell the LSMs that the process is doing an - * execve */ - unsigned in_iowait:1; - - /* Revert to default priority/policy when forking */ + /* scheduler bits, serialized by scheduler locks */ unsigned sched_reset_on_fork:1; unsigned sched_contributes_to_load:1; unsigned sched_migrated:1; + unsigned :0; /* force alignment to the next boundary */ + + /* unserialized, strictly 'current' */ + unsigned in_execve:1; /* bit to tell LSMs we're in execve */ + unsigned in_iowait:1; #ifdef CONFIG_MEMCG unsigned memcg_may_oom:1; #endif