login
Header Space

 
 

Re: [-mm] Add an owner to the mm_struct (v2)

Score:
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Paul Menage <menage@...>
Cc: Pavel Emelianov <xemul@...>, Hugh Dickins <hugh@...>, Sudhir Kumar <skumar@...>, YAMAMOTO Takashi <yamamoto@...>, <lizf@...>, <linux-kernel@...>, <taka@...>, <linux-mm@...>, David Rientjes <rientjes@...>, Andrew Morton <akpm@...>, KAMEZAWA Hiroyuki <kamezawa.hiroyu@...>
Date: Friday, March 28, 2008 - 8:36 am

Paul Menage wrote:

This will always hold, otherwise it cannot be the new owner :)


tsk->mm should not change unless the task is exiting or when a kernel thread
does use_mm() (PF_BORROWED_MM).

I see mm->owner changing when

1. The mm->owner exits
2. At fork time for clone calls with CLONE_VM

May be your rules will work, but I am yet to try that out.


There are other cases why I preferred to use it, specifically for PF_BORROWED_MM
cases. What if a kernel thread does use_mm() and fork()? Very unlikely, I'll
remove it and use p->mm directly.


Yes, thats a typo. A bad one :)


The intention is to handle the case when clone is called without CLONE_VM and
with CLONE_THREAD. This means that p can have it's own mm and a shared group_leader.



Yes, there is some stale code in mm/memcontrol.c and include/linux/memcontrol.h
(my bad)


Yes


Yes, will do


We don't need it and the comment is stale :)


Nope, my bad -- stale code. Will fix


Yes, good point. Will do


rcu_read_lock() also ensures that preemption does not cause us to see incorrect
values.


mm cannot go away, but mm->owner can be different from current and could be
going away.


Not at the moment, yes, we can remove the second parameter


OK


I would rather deal with the case where mm->owner is NULL, rather than keep
checking (since even with constant checking we cannot guarantee that mm->owner
will not become NULL)


Is there a for_each_thread()?


Won't it better to check for c->flags & PF_EXITING?


Let me try and revamp the locking rules and see what that leads to. But, I don't
like protecting an mm_struct's member with a task_struct's lock.



I don't expect to see that kind of restriction.


I thought of it, but wondered if the user should make an informed choice about
MM_OWNER and the overhead it brings along.



-- 
	Warm Regards,
	Balbir Singh
	Linux Technology Center
	IBM, ISTL
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[-mm] Add an owner to the mm_struct (v2), Balbir Singh, (Fri Mar 28, 4:23 am)
Re: [-mm] Add an owner to the mm_struct (v2), Paul Menage, (Fri Mar 28, 7:01 am)
Re: [-mm] Add an owner to the mm_struct (v2), Balbir Singh, (Fri Mar 28, 8:36 am)
Re: [-mm] Add an owner to the mm_struct (v2), Paul Menage, (Fri Mar 28, 10:05 am)
Re: [-mm] Add an owner to the mm_struct (v2), Balbir Singh, (Fri Mar 28, 10:52 am)
Re: [-mm] Add an owner to the mm_struct (v2), Paul Menage, (Fri Mar 28, 11:38 am)
Re: [-mm] Add an owner to the mm_struct (v2), Balbir Singh, (Fri Mar 28, 2:10 pm)
Re: [-mm] Add an owner to the mm_struct (v2), Paul Menage, (Fri Mar 28, 2:52 pm)
Re: [-mm] Add an owner to the mm_struct (v2), Balbir Singh, (Sat Mar 29, 1:46 am)
Re: [-mm] Add an owner to the mm_struct (v2), Balbir Singh, (Fri Mar 28, 9:02 pm)
Re: [-mm] Add an owner to the mm_struct (v2), Balbir Singh, (Fri Mar 28, 8:54 am)
Re: [-mm] Add an owner to the mm_struct (v2), Paul Menage, (Fri Mar 28, 10:06 am)
Re: [-mm] Add an owner to the mm_struct (v2), KAMEZAWA Hiroyuki, (Fri Mar 28, 6:55 am)
Re: [-mm] Add an owner to the mm_struct (v2), Balbir Singh, (Fri Mar 28, 6:52 am)
Re: [-mm] Add an owner to the mm_struct (v2), KAMEZAWA Hiroyuki, (Fri Mar 28, 7:15 am)
Re: [-mm] Add an owner to the mm_struct (v2), KAMEZAWA Hiroyuki, (Fri Mar 28, 7:21 am)
Re: [-mm] Add an owner to the mm_struct (v2), Paul Menage, (Fri Mar 28, 7:04 am)
Re: [-mm] Add an owner to the mm_struct (v2), KAMEZAWA Hiroyuki, (Fri Mar 28, 6:48 am)
Re: [-mm] Add an owner to the mm_struct (v2), Balbir Singh, (Fri Mar 28, 6:51 am)
Re: [-mm] Add an owner to the mm_struct (v2), KAMEZAWA Hiroyuki, (Fri Mar 28, 7:06 am)
Re: [-mm] Add an owner to the mm_struct (v2), Jiri Slaby, (Fri Mar 28, 5:41 am)
Re: [-mm] Add an owner to the mm_struct (v2), Jiri Slaby, (Fri Mar 28, 5:43 am)
Re: [-mm] Add an owner to the mm_struct (v2), Balbir Singh, (Fri Mar 28, 6:11 am)
speck-geostationary