lkml.org 
[lkml]   [2015]   [May]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Subject[PATCH RFC 04/13] exit: Small refactoring mm_update_next_owner()
From
Date
This will be used in next patches. No functionality change.

Signed-off-by: Kirill Tkhai <ktkhai@odin.com>
---
kernel/exit.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/kernel/exit.c b/kernel/exit.c
index a1b2bf7..5e82787 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -322,16 +322,20 @@ void mm_update_next_owner(struct mm_struct *mm)
* Search in the children
*/
list_for_each_entry(c, &p->children, sibling) {
- if (c->mm == mm)
+ if (c->mm == mm) {
+ get_task_struct(c);
goto assign_new_owner;
+ }
}

/*
* Search in the siblings
*/
list_for_each_entry(c, &p->real_parent->children, sibling) {
- if (c->mm == mm)
+ if (c->mm == mm) {
+ get_task_struct(c);
goto assign_new_owner;
+ }
}

/*
@@ -341,8 +345,10 @@ void mm_update_next_owner(struct mm_struct *mm)
if (g->flags & PF_KTHREAD)
continue;
for_each_thread(g, c) {
- if (c->mm == mm)
+ if (c->mm == mm) {
+ get_task_struct(c);
goto assign_new_owner;
+ }
if (c->mm)
break;
}
@@ -358,7 +364,6 @@ void mm_update_next_owner(struct mm_struct *mm)

assign_new_owner:
BUG_ON(c == p);
- get_task_struct(c);
/*
* The task_lock protects c->mm from changing.
* We always want mm->owner->mm == mm




\
 
 \ /
  Last update: 2015-05-25 20:21    [W:0.023 / U:1.044 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site