From: Christoph Lameter <clameter@sgi.com>
To: akpm@osdl.org
Cc: linux-kernel@vger.kernel.org,
Christoph Lameter <clameter@sgi.com>,
lhms-devel@lists.sourceforge.net
Subject: [PATCH 2/4] SwapMig: add_to_swap() avoid atomic allocations
Date: Thu, 17 Nov 2005 17:03:02 -0800 (PST) [thread overview]
Message-ID: <20051118010302.22328.14094.sendpatchset@schroedinger.engr.sgi.com> (raw)
In-Reply-To: <20051118010257.22328.49524.sendpatchset@schroedinger.engr.sgi.com>
Add gfp_mask to add_to_swap
add_to_swap does allocations with GFP_ATOMIC in order not to
interfere with swapping. During migration we may have
use add_to_swap extensively which may lead to out of memory
errors.
This patch makes add_to_swap take a parameter that specifies
the gfp mask. The page migration code can then make add_to_swap
use GFP_KERNEL.
Signed-off-by: Hirokazu Takahashi <taka@valinux.co.jp>
Signed-off-by: Dave Hansen <haveblue@us.ibm.com>
Signed-off-by: Christoph Lameter <clameter@sgi.com>
Index: linux-2.6.15-rc1-mm1/include/linux/swap.h
===================================================================
--- linux-2.6.15-rc1-mm1.orig/include/linux/swap.h 2005-11-17 16:55:05.000000000 -0800
+++ linux-2.6.15-rc1-mm1/include/linux/swap.h 2005-11-17 16:57:30.000000000 -0800
@@ -231,7 +231,7 @@ extern int rw_swap_page_sync(int, swp_en
extern struct address_space swapper_space;
#define total_swapcache_pages swapper_space.nrpages
extern void show_swap_cache_info(void);
-extern int add_to_swap(struct page *);
+extern int add_to_swap(struct page *, gfp_t);
extern void __delete_from_swap_cache(struct page *);
extern void delete_from_swap_cache(struct page *);
extern int move_to_swap_cache(struct page *, swp_entry_t);
Index: linux-2.6.15-rc1-mm1/mm/swap_state.c
===================================================================
--- linux-2.6.15-rc1-mm1.orig/mm/swap_state.c 2005-11-17 15:17:32.000000000 -0800
+++ linux-2.6.15-rc1-mm1/mm/swap_state.c 2005-11-17 16:57:30.000000000 -0800
@@ -142,7 +142,7 @@ void __delete_from_swap_cache(struct pag
* Allocate swap space for the page and add the page to the
* swap cache. Caller needs to hold the page lock.
*/
-int add_to_swap(struct page * page)
+int add_to_swap(struct page * page, gfp_t gfp_mask)
{
swp_entry_t entry;
int err;
@@ -170,7 +170,7 @@ int add_to_swap(struct page * page)
* Add it to the swap cache and mark it dirty
*/
err = __add_to_swap_cache(page, entry,
- GFP_ATOMIC|__GFP_NOMEMALLOC|__GFP_NOWARN);
+ gfp_mask|__GFP_NOMEMALLOC|__GFP_NOWARN);
switch (err) {
case 0: /* Success */
Index: linux-2.6.15-rc1-mm1/mm/vmscan.c
===================================================================
--- linux-2.6.15-rc1-mm1.orig/mm/vmscan.c 2005-11-17 16:55:49.000000000 -0800
+++ linux-2.6.15-rc1-mm1/mm/vmscan.c 2005-11-17 16:57:30.000000000 -0800
@@ -455,7 +455,7 @@ static int shrink_list(struct list_head
if (PageAnon(page) && !PageSwapCache(page)) {
if (!sc->may_swap)
goto keep_locked;
- if (!add_to_swap(page))
+ if (!add_to_swap(page, GFP_ATOMIC))
goto activate_locked;
}
#endif /* CONFIG_SWAP */
@@ -726,7 +726,7 @@ redo:
}
if (PageAnon(page) && !PageSwapCache(page)) {
- if (!add_to_swap(page)) {
+ if (!add_to_swap(page, GFP_KERNEL)) {
unlock_page(page);
list_move(&page->lru, &failed);
nr_failed++;
next prev parent reply other threads:[~2005-11-18 1:03 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-11-18 1:02 [PATCH 1/4] SwapMig: [resend] CONFIG_MIGRATION fixes Christoph Lameter
2005-11-18 1:03 ` Christoph Lameter [this message]
2005-11-18 1:03 ` [PATCH 3/4] SwapMig: Drop unused pages immediately Christoph Lameter
2005-11-18 1:03 ` [PATCH 4/4] SwapMig: Extend parameters for migrate_pages() Christoph Lameter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20051118010302.22328.14094.sendpatchset@schroedinger.engr.sgi.com \
--to=clameter@sgi.com \
--cc=akpm@osdl.org \
--cc=lhms-devel@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome