linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* Locking issue on try_to_swap_out()
@ 2001-01-14 13:57 Marcelo Tosatti
  2001-01-17  7:13 ` Rik van Riel
  0 siblings, 1 reply; 2+ messages in thread
From: Marcelo Tosatti @ 2001-01-14 13:57 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: linux-mm

Hi Linus,

In theory, there is nothing which guarantees that nobody will mess with
the page between "UnlockPage" and "deactivate_page" (that is pretty hard
to happen, I suppose, but anyway)

--- mm/vmscan.c.orig       Sun Jan 14 13:23:55 2001
+++ mm/vmscan.c    Sun Jan 14 13:24:16 2001
@@ -72,10 +72,10 @@
                swap_duplicate(entry);
                set_pte(page_table, swp_entry_to_pte(entry));
 drop_pte:
-               UnlockPage(page);
                mm->rss--;
                if (!page->age)
                        deactivate_page(page);
+               UnlockPage(page);
                page_cache_release(page);
                return;
        }


--
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.eu.org/Linux-MM/

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

* Re: Locking issue on try_to_swap_out()
  2001-01-14 13:57 Locking issue on try_to_swap_out() Marcelo Tosatti
@ 2001-01-17  7:13 ` Rik van Riel
  0 siblings, 0 replies; 2+ messages in thread
From: Rik van Riel @ 2001-01-17  7:13 UTC (permalink / raw)
  To: Marcelo Tosatti; +Cc: Linus Torvalds, linux-mm

On Sun, 14 Jan 2001, Marcelo Tosatti wrote:

> In theory, there is nothing which guarantees that nobody will
> mess with the page between "UnlockPage" and "deactivate_page"
> (that is pretty hard to happen, I suppose, but anyway)
>
> --- mm/vmscan.c.orig       Sun Jan 14 13:23:55 2001
> +++ mm/vmscan.c    Sun Jan 14 13:24:16 2001
> @@ -72,10 +72,10 @@
>                 swap_duplicate(entry);
>                 set_pte(page_table, swp_entry_to_pte(entry));
>  drop_pte:
> -               UnlockPage(page);
>                 mm->rss--;
>                 if (!page->age)
>                         deactivate_page(page);
> +               UnlockPage(page);
>                 page_cache_release(page);
>                 return;
>         }

Why do you suppose the page_cache_release(page) is BELOW
the deactivate_page(page) call ?

We are still holding a reference on the page when we call
deactivate_page(page), this is what keeps the page from
going away from under us.

regards,

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://www.conectiva.com/	http://distro.conectiva.com.br/

--
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.eu.org/Linux-MM/

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

end of thread, other threads:[~2001-01-17  7:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-01-14 13:57 Locking issue on try_to_swap_out() Marcelo Tosatti
2001-01-17  7:13 ` Rik van Riel

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