[PATCH] memcg: shmem_getpage release page sooner

From: Hugh Dickins
Date: Sat Jun 28 2008 - 20:14:37 EST


No big deal, but since mem_cgroup_shrink_usage doesn't require a page to
operate upon, page_cache_release the swappage before calling it, so it's
not pinned across the reclaim.

Signed-off-by: Hugh Dickins <hugh@xxxxxxxxxxx>
---
Should follow mmotm's memcg-helper-function-for-relcaim-from-shmem.patch

mm/shmem.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)

--- mmotm/mm/shmem.c 2008-06-27 13:39:20.000000000 +0100
+++ linux/mm/shmem.c 2008-06-27 17:25:41.000000000 +0100
@@ -1315,16 +1315,14 @@ repeat:
shmem_swp_unmap(entry);
spin_unlock(&info->lock);
unlock_page(swappage);
+ page_cache_release(swappage);
if (error == -ENOMEM) {
/* allow reclaim from this memory cgroup */
error = mem_cgroup_shrink_usage(current->mm,
- gfp & ~__GFP_HIGHMEM);
- if (error) {
- page_cache_release(swappage);
+ gfp);
+ if (error)
goto failed;
- }
}
- page_cache_release(swappage);
goto repeat;
}
} else if (sgp == SGP_READ && !filepage) {
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/