* [PATCH] shrink_list skip anon pages if not may_swap
@ 2005-09-12 17:29 Lee Schermerhorn
2005-09-12 23:21 ` Rik van Riel
2005-09-13 1:21 ` Martin Hicks
0 siblings, 2 replies; 3+ messages in thread
From: Lee Schermerhorn @ 2005-09-12 17:29 UTC (permalink / raw)
To: linux-mm; +Cc: Martin Hicks, lhms-devel
Martin Hicks' page cache reclaim patch added the 'may_swap' flag to the
scan_control struct; and modified shrink_list() not to add anon pages to
the swap cache if may_swap is not asserted.
Ref: http://marc.theaimsgroup.com/?l=linux-mm&m=111461480725322&w=4
However, further down, if the page is mapped, shrink_list() calls
try_to_unmap() which will call try_to_unmap_one() via try_to_unmap_anon
(). try_to_unmap_one() will BUG_ON() an anon page that is NOT in the
swap cache. Martin says he never encountered this path in his testing,
but agrees that it might happen.
This patch modifies shrink_list() to skip anon pages that are not
already in the swap cache when !may_swap, rather than just not adding
them to the cache.
Cc to lhms-devel because memory hotplug page migration also uses
shrink_list.
Signed-off-by: Lee Schermerhorn <lee.schermerhorn@hp.com>
============================================================
--- shrink_list-skip-anon-pages-if-not-may_swap/mm/vmscan.c~original 2005-08-28 19:41:01.000000000 -0400
+++ shrink_list-skip-anon-pages-if-not-may_swap/mm/vmscan.c 2005-09-12 10:17:01.000000000 -0400
@@ -417,7 +417,9 @@ static int shrink_list(struct list_head
* Anonymous process memory has backing store?
* Try to allocate it some swap space here.
*/
- if (PageAnon(page) && !PageSwapCache(page) && sc->may_swap) {
+ if (PageAnon(page) && !PageSwapCache(page)) {
+ if (!sc->may_swap)
+ goto keep_locked;
if (!add_to_swap(page))
goto activate_locked;
}
--
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] 3+ messages in thread
* Re: [PATCH] shrink_list skip anon pages if not may_swap
2005-09-12 17:29 [PATCH] shrink_list skip anon pages if not may_swap Lee Schermerhorn
@ 2005-09-12 23:21 ` Rik van Riel
2005-09-13 1:21 ` Martin Hicks
1 sibling, 0 replies; 3+ messages in thread
From: Rik van Riel @ 2005-09-12 23:21 UTC (permalink / raw)
To: Lee Schermerhorn; +Cc: linux-mm, Martin Hicks, lhms-devel
On Mon, 12 Sep 2005, Lee Schermerhorn wrote:
> This patch modifies shrink_list() to skip anon pages that are not
> already in the swap cache when !may_swap, rather than just not adding
> them to the cache.
Nice catch!
--
All Rights Reversed
--
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] 3+ messages in thread
* Re: [PATCH] shrink_list skip anon pages if not may_swap
2005-09-12 17:29 [PATCH] shrink_list skip anon pages if not may_swap Lee Schermerhorn
2005-09-12 23:21 ` Rik van Riel
@ 2005-09-13 1:21 ` Martin Hicks
1 sibling, 0 replies; 3+ messages in thread
From: Martin Hicks @ 2005-09-13 1:21 UTC (permalink / raw)
To: Lee Schermerhorn; +Cc: linux-mm, Martin Hicks, lhms-devel
On Mon, Sep 12, 2005 at 01:29:51PM -0400, Lee Schermerhorn wrote:
>
> Cc to lhms-devel because memory hotplug page migration also uses
> shrink_list.
>
> Signed-off-by: Lee Schermerhorn <lee.schermerhorn@hp.com>
Acked-by: Martin Hicks <mort@sgi.com>
Lee already e-mail me privately about this issue. Nice catch indeed.
thanks
mh
> ============================================================
> --- shrink_list-skip-anon-pages-if-not-may_swap/mm/vmscan.c~original 2005-08-28 19:41:01.000000000 -0400
> +++ shrink_list-skip-anon-pages-if-not-may_swap/mm/vmscan.c 2005-09-12 10:17:01.000000000 -0400
> @@ -417,7 +417,9 @@ static int shrink_list(struct list_head
> * Anonymous process memory has backing store?
> * Try to allocate it some swap space here.
> */
> - if (PageAnon(page) && !PageSwapCache(page) && sc->may_swap) {
> + if (PageAnon(page) && !PageSwapCache(page)) {
> + if (!sc->may_swap)
> + goto keep_locked;
> if (!add_to_swap(page))
> goto activate_locked;
> }
>
>
--
Martin Hicks || Silicon Graphics Inc. || mort@sgi.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/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2005-09-13 1:21 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-09-12 17:29 [PATCH] shrink_list skip anon pages if not may_swap Lee Schermerhorn
2005-09-12 23:21 ` Rik van Riel
2005-09-13 1:21 ` Martin Hicks
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox