linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* Question:  cpuset_update_task_memory_state() and mmap_sem ???
@ 2007-08-13 19:38 Lee Schermerhorn
  2007-08-16  6:06 ` Paul Jackson
  0 siblings, 1 reply; 4+ messages in thread
From: Lee Schermerhorn @ 2007-08-13 19:38 UTC (permalink / raw)
  To: Paul Jackson; +Cc: linux-mm

In the comment block for the subject function in cpuset.c, it notes that
"This routine also might acquire callback_mutex and
current->mm->mmap_sem."

Is this is a stale comment?  I can't find any path from this function to
a down_{read|write}() on the caller's mmap_sem [in 23-rc2-mm2].  I
suspect that one would have noticed, as
cpuset_update_task_memory_state() is called from
alloc_page_vma() which, according to its comment block, can only be
called with the mmap_sem held [for read, at least].

Lee

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Question:  cpuset_update_task_memory_state() and mmap_sem ???
  2007-08-13 19:38 Question: cpuset_update_task_memory_state() and mmap_sem ??? Lee Schermerhorn
@ 2007-08-16  6:06 ` Paul Jackson
  2007-08-16 13:12   ` Lee Schermerhorn
  0 siblings, 1 reply; 4+ messages in thread
From: Paul Jackson @ 2007-08-16  6:06 UTC (permalink / raw)
  To: Lee Schermerhorn; +Cc: linux-mm

Lee wrote:
> In the comment block for the subject function in cpuset.c, it notes that
> "This routine also might acquire callback_mutex and
> current->mm->mmap_sem."
> 
> Is this is a stale comment?  I can't find any path from this function to
> a down_{read|write}() on the caller's mmap_sem [in 23-rc2-mm2].  I
> suspect that one would have noticed, as
> cpuset_update_task_memory_state() is called from
> alloc_page_vma() which, according to its comment block, can only be
> called with the mmap_sem held [for read, at least].

Hmmm ... you may be right  But I'm not sure.

Obviously, the callback_mutex mention in the comment is correct,
but the current->mm->mmap_sem mention seems bogus.

The routine mpol_rebind_task() is called from the last line of
cpuset_update_task_memory_state().  Whatever mmap_sem is taken
would be within that call.  But I can't find any taking of
mmap_sem within or below mpol_rebind_task(), and all the code
paths in mm/mempolicy.c that do take mmap_sem locks seem to be
on unrelated code paths.

I tried looking in a few old versions of kernel/cpuset.c and
mm/mempolicy.c to see if the mention of current->mm->mmap_sem
made more sense in some old version, but didn't see any version
of code that justified that comment.

... would you like to propose a patch, nuking the phrase:

   and current->mm->mmap_sem

from that comment?

-- 
                  I won't rest till it's the best ...
                  Programmer, Linux Scalability
                  Paul Jackson <pj@sgi.com> 1.925.600.0401

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Question:  cpuset_update_task_memory_state() and mmap_sem ???
  2007-08-16  6:06 ` Paul Jackson
@ 2007-08-16 13:12   ` Lee Schermerhorn
  2007-08-16 15:43     ` Paul Jackson
  0 siblings, 1 reply; 4+ messages in thread
From: Lee Schermerhorn @ 2007-08-16 13:12 UTC (permalink / raw)
  To: Paul Jackson; +Cc: linux-mm

On Wed, 2007-08-15 at 23:06 -0700, Paul Jackson wrote:
> Lee wrote:
> > In the comment block for the subject function in cpuset.c, it notes that
> > "This routine also might acquire callback_mutex and
> > current->mm->mmap_sem."
> > 
> > Is this is a stale comment?  I can't find any path from this function to
> > a down_{read|write}() on the caller's mmap_sem [in 23-rc2-mm2].  I
> > suspect that one would have noticed, as
> > cpuset_update_task_memory_state() is called from
> > alloc_page_vma() which, according to its comment block, can only be
> > called with the mmap_sem held [for read, at least].
> 
> Hmmm ... you may be right  But I'm not sure.
> 
> Obviously, the callback_mutex mention in the comment is correct,
> but the current->mm->mmap_sem mention seems bogus.
> 
> The routine mpol_rebind_task() is called from the last line of
> cpuset_update_task_memory_state().  Whatever mmap_sem is taken
> would be within that call.  But I can't find any taking of
> mmap_sem within or below mpol_rebind_task(), and all the code
> paths in mm/mempolicy.c that do take mmap_sem locks seem to be
> on unrelated code paths.
> 
> I tried looking in a few old versions of kernel/cpuset.c and
> mm/mempolicy.c to see if the mention of current->mm->mmap_sem
> made more sense in some old version, but didn't see any version
> of code that justified that comment.
> 
> ... would you like to propose a patch, nuking the phrase:
> 
>    and current->mm->mmap_sem
> 
> from that comment?

If that's the correct thing to do, sure.  Just wanted to check with you
whether I was missing something.   

Lee
> 

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Question:  cpuset_update_task_memory_state() and mmap_sem ???
  2007-08-16 13:12   ` Lee Schermerhorn
@ 2007-08-16 15:43     ` Paul Jackson
  0 siblings, 0 replies; 4+ messages in thread
From: Paul Jackson @ 2007-08-16 15:43 UTC (permalink / raw)
  To: Lee Schermerhorn; +Cc: linux-mm

Lee, responding to pj:
> > ... would you like to propose a patch, nuking the phrase:
> > 
> >    and current->mm->mmap_sem
> > 
> > from that comment?
> 
> If that's the correct thing to do, sure.  Just wanted to check with you
> whether I was missing something.   

As best as I can tell, it's the correct thing to do, yes.

-- 
                  I won't rest till it's the best ...
                  Programmer, Linux Scalability
                  Paul Jackson <pj@sgi.com> 1.925.600.0401

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-08-16 15:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-08-13 19:38 Question: cpuset_update_task_memory_state() and mmap_sem ??? Lee Schermerhorn
2007-08-16  6:06 ` Paul Jackson
2007-08-16 13:12   ` Lee Schermerhorn
2007-08-16 15:43     ` Paul Jackson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox