Skip to contentSkip to conversation

numa api: Add policy support to anonymous memory

PATCH In review [email protected] 1 participant 1 message May 22, 2004

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 28/57 numa api: Add policy support to anonymous memory

From: Andi Kleen <[email protected]>

Change to core VM to use alloc_page_vma() instead of alloc_page().

Change the swap readahead to follow the policy of the VMA.

---

 25-akpm/include/linux/swap.h |    7 ++++---
 25-akpm/mm/memory.c          |   43 ++++++++++++++++++++++++++++++++++++-------
 25-akpm/mm/swap_state.c      |    5 +++--
 25-akpm/mm/swapfile.c        |    2 +-
 4 files changed, 44 insertions(+), 13 deletions(-)
include/linux/swap.h renamed from include/linux/swap.h~numa-api-anon-memory-policy +4 -3
diff -puN include/linux/swap.h~numa-api-anon-memory-policy include/linux/swap.h
@@ -151,7 +151,7 @@ struct swap_list_t {
 extern void out_of_memory(void);
 
 /* linux/mm/memory.c */
-extern void swapin_readahead(swp_entry_t);
+extern void swapin_readahead(swp_entry_t, unsigned long, struct vm_area_struct *);
 
 /* linux/mm/page_alloc.c */
 extern unsigned long totalram_pages;
@@ -202,7 +202,8 @@ extern int move_from_swap_cache(struct p
 extern void free_page_and_swap_cache(struct page *);
 extern void free_pages_and_swap_cache(struct page **, int);
 extern struct page * lookup_swap_cache(swp_entry_t);
-extern struct page * read_swap_cache_async(swp_entry_t);
+extern struct page * read_swap_cache_async(swp_entry_t, struct vm_area_struct *vma,
+					   unsigned long addr);
 
 /* linux/mm/swapfile.c */
 extern int total_swap_pages;
@@ -244,7 +245,7 @@ extern spinlock_t swaplock;
 #define free_swap_and_cache(swp)		/*NOTHING*/
 #define swap_duplicate(swp)			/*NOTHING*/
 #define swap_free(swp)				/*NOTHING*/
-#define read_swap_cache_async(swp)		NULL
+#define read_swap_cache_async(swp,vma,addr)	NULL
 #define lookup_swap_cache(swp)			NULL
 #define valid_swaphandles(swp, off)		0
 #define can_share_swap_page(p)			0
mm/memory.c renamed from mm/memory.c~numa-api-anon-memory-policy +36 -7

84 lines not on this page · raw message

mm/swapfile.c renamed from mm/swapfile.c~numa-api-anon-memory-policy +1 -1
diff -puN mm/swapfile.c~numa-api-anon-memory-policy mm/swapfile.c
@@ -657,7 +657,7 @@ static int try_to_unuse(unsigned int typ
 		 */
 		swap_map = &si->swap_map[i];
 		entry = swp_entry(type, i);
-		page = read_swap_cache_async(entry);
+		page = read_swap_cache_async(entry, NULL, 0);
 		if (!page) {
 			/*
 			 * Either swap_duplicate() failed because entry
mm/swap_state.c renamed from mm/swap_state.c~numa-api-anon-memory-policy +3 -2
diff -puN mm/swap_state.c~numa-api-anon-memory-policy mm/swap_state.c
@@ -327,7 +327,8 @@ struct page * lookup_swap_cache(swp_entr
  * A failure return means that either the page allocation failed or that
  * the swap entry is no longer in use.
  */
-struct page * read_swap_cache_async(swp_entry_t entry)
+struct page *read_swap_cache_async(swp_entry_t entry,
+			struct vm_area_struct *vma, unsigned long addr)
 {
 	struct page *found_page, *new_page = NULL;
 	int err;
@@ -351,7 +352,7 @@ struct page * read_swap_cache_async(swp_
 		 * Get a new page to read into from swap.
 		 */
 		if (!new_page) {
-			new_page = alloc_page(GFP_HIGHUSER);
+			new_page = alloc_page_vma(GFP_HIGHUSER, vma, addr);
 			if (!new_page)
 				break;		/* Out of memory */
 		}

_
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>