Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751252AbbEYRp0 (ORCPT ); Mon, 25 May 2015 13:45:26 -0400 Received: from relay.parallels.com ([195.214.232.42]:44173 "EHLO relay.parallels.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750903AbbEYRpX (ORCPT ); Mon, 25 May 2015 13:45:23 -0400 Message-ID: <1432575916.6866.38.camel@odin.com> Subject: [PATCH RFC 06/13] core: Add rwlock_t task_list::kin_lock From: Kirill Tkhai To: CC: Oleg Nesterov , Andrew Morton , Ingo Molnar , "Peter Zijlstra" , Michal Hocko , "Rik van Riel" , Ionut Alexa , Peter Hurley , Kirill Tkhai Date: Mon, 25 May 2015 20:45:16 +0300 In-Reply-To: <20150525162722.5171.15901.stgit@pro> References: <20150525162722.5171.15901.stgit@pro> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.12.9-1+b1 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Originating-IP: [10.30.16.109] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1941 Lines: 54 Add a new primitive for synchronization between relatives. It will be used in next/further patches. Signed-off-by: Kirill Tkhai --- include/linux/init_task.h | 1 + include/linux/sched.h | 1 + kernel/fork.c | 1 + 3 files changed, 3 insertions(+) diff --git a/include/linux/init_task.h b/include/linux/init_task.h index bb9b075..919243a 100644 --- a/include/linux/init_task.h +++ b/include/linux/init_task.h @@ -218,6 +218,7 @@ extern struct task_group root_task_group; .parent = &tsk, \ .children = LIST_HEAD_INIT(tsk.children), \ .sibling = LIST_HEAD_INIT(tsk.sibling), \ + .kin_lock = __RW_LOCK_UNLOCKED(tsk.kin_lock), \ .group_leader = &tsk, \ RCU_POINTER_INITIALIZER(real_cred, &init_cred), \ RCU_POINTER_INITIALIZER(cred, &init_cred), \ diff --git a/include/linux/sched.h b/include/linux/sched.h index af0eeba..58dc09f 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -1477,6 +1477,7 @@ struct task_struct { struct list_head children; /* list of my children */ struct list_head sibling; /* linkage in my parent's children list */ struct task_struct *group_leader; /* threadgroup leader */ + rwlock_t kin_lock; /* * ptraced is the list of tasks this task is using ptrace on. diff --git a/kernel/fork.c b/kernel/fork.c index 66e31eb..ee389ba 100644 --- a/kernel/fork.c +++ b/kernel/fork.c @@ -1330,6 +1330,7 @@ static struct task_struct *copy_process(unsigned long clone_flags, p->flags |= PF_FORKNOEXEC; INIT_LIST_HEAD(&p->children); INIT_LIST_HEAD(&p->sibling); + rwlock_init(&p->kin_lock); rcu_copy_process(p); p->vfork_done = NULL; spin_lock_init(&p->alloc_lock); -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/