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: <balbir@...>
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 - 2:52 pm

Hi Balbir,

Could you send out the latest version of your patch? I suspect it's
changed a bit based on on this review and it would be good to make
sure we're both on the same page.

On Fri, Mar 28, 2008 at 11:10 AM, Balbir Singh
<balbir@linux.vnet.ibm.com> wrote:

Why would you want to overwrite mm->owner for any of the threads? If
they're sharing an existing mm, then that mm must already have an
owner, so no need to update it.


A couple of issues with that:

- I'm not sure how that handles the exec case

- assume two users; the owner exits and wants to pass the ownership to
the other user. It finds it, but sees that it's PF_EXITING. What
should it do? If it waits for that other user to exit, it could take a
long time (e.g. core dumps can take many seconds). If it exits
immediately, then it will leave mm->owner pointing to an invalid task.
If it passes ownership to the other task, it might pass it after the
other task had done its mm_update_next_owner() check, which would be
too late.

- assume three users; the owner exits and wants to pass the ownership
to one of the other two users. it searches through the candidates and
finds one of the other users, which is in PF_EXITING, so it skips it.
Just after this it sees that the user count has fallen to two users.
How does it know whether the user that dropped the count was the
PF_EXITING process that it saw previously (in which case it should
keep searching) or the third user that it's not encountered yet (in
which case it's not going to find the other user anywhere in its
search).


How about the following sequence: A is old owner, B is new owner

A gets to the task_unlock() in exit_mm(): A->mm is now NULL, mm->owner == A
B starts to execve()
A calls mm_update_next_owner()
B gets to the "active_mm = tsk->active_mm" in exec_mmap()
A finds that B->mm == mm
B continues through the critical section, gets past the point where it
needs to check for ownership
A sets mm->owner = B
B finishes its exec, and carries on with its new mmap



Yes, but once we've set mm->owner to the other task and released its
task_lock, the new owner is responsible for handing off the mm to yet
another owner if necessary.


We're not protecting mm->owner - we're protecting new_owner->mm

Paul
--
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