summaryrefslogtreecommitdiffstats
path: root/mm/vmscan.c
diff options
context:
space:
mode:
Diffstat (limited to 'mm/vmscan.c')
-rw-r--r--mm/vmscan.c29
1 files changed, 14 insertions, 15 deletions
diff --git a/mm/vmscan.c b/mm/vmscan.c
index 116096153..d651e6f94 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -45,12 +45,7 @@ static int try_to_swap_out(struct task_struct * tsk, struct vm_area_struct* vma,
page = pte_page(pte);
if (MAP_NR(page) >= max_mapnr)
return 0;
-
page_map = mem_map + MAP_NR(page);
- if (PageReserved(page_map)
- || PageLocked(page_map)
- || ((gfp_mask & __GFP_DMA) && !PageDMA(page_map)))
- return 0;
if (pte_young(pte)) {
/*
@@ -62,6 +57,11 @@ static int try_to_swap_out(struct task_struct * tsk, struct vm_area_struct* vma,
return 0;
}
+ if (PageReserved(page_map)
+ || PageLocked(page_map)
+ || ((gfp_mask & __GFP_DMA) && !PageDMA(page_map)))
+ return 0;
+
/*
* Is the page already in the swap cache? If so, then
* we can just drop our reference to it without doing
@@ -202,7 +202,7 @@ static inline int swap_out_pmd(struct task_struct * tsk, struct vm_area_struct *
do {
int result;
- tsk->swap_address = address + PAGE_SIZE;
+ tsk->mm->swap_address = address + PAGE_SIZE;
result = try_to_swap_out(tsk, vma, address, pte, gfp_mask);
if (result)
return result;
@@ -248,9 +248,8 @@ static int swap_out_vma(struct task_struct * tsk, struct vm_area_struct * vma,
pgd_t *pgdir;
unsigned long end;
- /* Don't swap out areas like shared memory which have their
- own separate swapping mechanism or areas which are locked down */
- if (vma->vm_flags & (VM_SHM | VM_LOCKED))
+ /* Don't swap out areas which are locked down */
+ if (vma->vm_flags & VM_LOCKED)
return 0;
pgdir = pgd_offset(tsk->mm, address);
@@ -274,7 +273,7 @@ static int swap_out_process(struct task_struct * p, int gfp_mask)
/*
* Go through process' page directory.
*/
- address = p->swap_address;
+ address = p->mm->swap_address;
/*
* Find the proper vm-area
@@ -296,8 +295,8 @@ static int swap_out_process(struct task_struct * p, int gfp_mask)
}
/* We didn't find anything for the process */
- p->swap_cnt = 0;
- p->swap_address = 0;
+ p->mm->swap_cnt = 0;
+ p->mm->swap_address = 0;
return 0;
}
@@ -345,9 +344,9 @@ static int swap_out(unsigned int priority, int gfp_mask)
continue;
/* Refresh swap_cnt? */
if (assign)
- p->swap_cnt = p->mm->rss;
- if (p->swap_cnt > max_cnt) {
- max_cnt = p->swap_cnt;
+ p->mm->swap_cnt = p->mm->rss;
+ if (p->mm->swap_cnt > max_cnt) {
+ max_cnt = p->mm->swap_cnt;
pbest = p;
}
}