linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* Can reverse VM locks?
@ 2001-07-02 18:39 markhe
  2001-07-02 19:02 ` Rik van Riel
  0 siblings, 1 reply; 6+ messages in thread
From: markhe @ 2001-07-02 18:39 UTC (permalink / raw)
  To: Rik van Riel; +Cc: linux-mm

Hi,

  I have been working with a quite old kernel tree, where
__find_page_nolock() was calling age_page_up() (which could have ended up
taking the "pagemap_lru_lock").
  Looking at recent kernels, I see that __find_page_nolock() is now simply
setting the PG_referenced bit.

  As far as I am aware, the old behaviour of __find_page_nolock() defined
the lock ordering between the "pagecache_lock" and "pagemap_lru_lock", and
other places had to follow this ordering.

  Now, isn't is possible to reverse this ordering?

  The reason for wanting to do so is scalability - the "pagecache_lock"
suffers from contention on high-way boxes.

  In functions, such as reclaim_page() and invalidate_inode_pages(), the
"pagecache_lock" is taken earlier than needed due to the lock ordering
with "page_lru_lock".  It should now be possible to delay taking this lock
until after the "page_lru_lock" and until some of the tests have been
preformed on the page (some of the tests would need to be redo after
taking the lock to avoid dangerious false negatives).

  Anyone know of any places where reversing the lock ordering would break?
  Unless anyone can think of any serious issues, I'll start coding this up
tomorrow (and find the issues for myself :)).

Thanks,
Mark

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

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

* Re: Can reverse VM locks?
  2001-07-02 18:39 Can reverse VM locks? markhe
@ 2001-07-02 19:02 ` Rik van Riel
  2001-07-02 19:22   ` markhe
  0 siblings, 1 reply; 6+ messages in thread
From: Rik van Riel @ 2001-07-02 19:02 UTC (permalink / raw)
  To: markhe; +Cc: linux-mm

On Mon, 2 Jul 2001 markhe@veritas.com wrote:

>   Anyone know of any places where reversing the lock ordering would break?

Basically add_to_page_cache and remove_from_page cache and friends ;)

Rik
--
Virtual memory is like a game you can't win;
However, without VM there's truly nothing to lose...

http://www.surriel.com/		http://distro.conectiva.com/

Send all your spam to aardvark@nl.linux.org (spam digging piggy)

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

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

* Re: Can reverse VM locks?
  2001-07-02 19:02 ` Rik van Riel
@ 2001-07-02 19:22   ` markhe
  2001-07-02 19:38     ` Rik van Riel
  2001-07-30 19:10     ` Rik van Riel
  0 siblings, 2 replies; 6+ messages in thread
From: markhe @ 2001-07-02 19:22 UTC (permalink / raw)
  To: Rik van Riel; +Cc: linux-mm

On Mon, 2 Jul 2001, Rik van Riel wrote:
> On Mon, 2 Jul 2001 markhe@veritas.com wrote:
>
> >   Anyone know of any places where reversing the lock ordering would break?
>
> Basically add_to_page_cache and remove_from_page cache and friends ;)

  Hmm, does a page-cache page need to be on an LRU list?

  If not, the 'add' case falls out OK; add it to the page-cache first,
then add it to an LRU list _after_ dropping the pagecache_lock and taking
the pagemap_lru_lock.  ie. no lock overlap.

  For the delete/remove case, aren't both the locks normally held for this
anyway?  With the locks being reversed, they would still both be held (as
in reclaim_page(), invalidate_inode_pages()).
  For  truncate_complete_page(), there is no lock overlap so no problem.
True?

Mark

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

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

* Re: Can reverse VM locks?
  2001-07-02 19:22   ` markhe
@ 2001-07-02 19:38     ` Rik van Riel
  2001-07-30 19:10     ` Rik van Riel
  1 sibling, 0 replies; 6+ messages in thread
From: Rik van Riel @ 2001-07-02 19:38 UTC (permalink / raw)
  To: markhe; +Cc: linux-mm

On Mon, 2 Jul 2001 markhe@veritas.com wrote:

> True?

Yes, I think it is. Reversing the order of these locks would
be cool indeed (especially for 2.5 ;))

Rik
--
Virtual memory is like a game you can't win;
However, without VM there's truly nothing to lose...

http://www.surriel.com/		http://distro.conectiva.com/

Send all your spam to aardvark@nl.linux.org (spam digging piggy)

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

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

* Re: Can reverse VM locks?
  2001-07-02 19:22   ` markhe
  2001-07-02 19:38     ` Rik van Riel
@ 2001-07-30 19:10     ` Rik van Riel
  2001-07-30 19:33       ` Mark Hemment
  1 sibling, 1 reply; 6+ messages in thread
From: Rik van Riel @ 2001-07-30 19:10 UTC (permalink / raw)
  To: markhe; +Cc: linux-mm

OK, I've been looking at the lock order reversal too,
though for different reasons ;)

On Mon, 2 Jul 2001 markhe@veritas.com wrote:
> On Mon, 2 Jul 2001, Rik van Riel wrote:
> > On Mon, 2 Jul 2001 markhe@veritas.com wrote:
> >
> > >   Anyone know of any places where reversing the lock ordering would break?
> >
> > Basically add_to_page_cache and remove_from_page cache and friends ;)
>
>   Hmm, does a page-cache page need to be on an LRU list?
>
>   If not, the 'add' case falls out OK; add it to the page-cache
> first, then add it to an LRU list _after_ dropping the
> pagecache_lock and taking the pagemap_lru_lock.  ie. no lock
> overlap.

Indeed, this would work. I've been looking at this too.

	[snip cool analysis]
> True?

Yes, very much true.  Now what I wanted to ask about:
do you already have a patch which does this or should
I write a patch which does the lock order reversal ?

cheers,

Rik
--
Executive summary of a recent Microsoft press release:
   "we are concerned about the GNU General Public License (GPL)"


		http://www.surriel.com/
http://www.conectiva.com/	http://distro.conectiva.com/


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

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

* Re: Can reverse VM locks?
  2001-07-30 19:10     ` Rik van Riel
@ 2001-07-30 19:33       ` Mark Hemment
  0 siblings, 0 replies; 6+ messages in thread
From: Mark Hemment @ 2001-07-30 19:33 UTC (permalink / raw)
  To: Rik van Riel; +Cc: linux-mm

On Mon, 30 Jul 2001, Rik van Riel wrote:

> OK, I've been looking at the lock order reversal too,
> though for different reasons ;)
>
> On Mon, 2 Jul 2001 markhe@veritas.com wrote:
> > On Mon, 2 Jul 2001, Rik van Riel wrote:
> > > On Mon, 2 Jul 2001 markhe@veritas.com wrote:
> > >
> > > >   Anyone know of any places where reversing the lock ordering would break?
>
> Yes, very much true.  Now what I wanted to ask about:
> do you already have a patch which does this or should
> I write a patch which does the lock order reversal ?

  I did do it, only took a couple of hours, but didn't show any measurable
improvement on a four-way box so I put it on the back-burner.  It is
probably lying around on an off-lined disk somewhere - I'll try to dig it
out tomorrow (time for pub/home in the UK), or re-code it.

  Three points to note;
	1) Looked like it might allow for easily coding of per page-cache
	   line spinlocks (if we want to go there).
	2) I suspected the pagemap_lru_lock was still under heavy
	   contention (the reversal wouldn't have helped it).
	3) In filemap.c, the pagecache_lock and pagemap_lru_lock are far
	   too "close" - need to be L1 cached aligned.

Mark

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

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

end of thread, other threads:[~2001-07-30 19:33 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-07-02 18:39 Can reverse VM locks? markhe
2001-07-02 19:02 ` Rik van Riel
2001-07-02 19:22   ` markhe
2001-07-02 19:38     ` Rik van Riel
2001-07-30 19:10     ` Rik van Riel
2001-07-30 19:33       ` Mark Hemment

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