[PATCH 5/9] clockpro-ignore_token.patch
- From: Peter Zijlstra <a.p.zijlstra@xxxxxxxxx>
- Date: Fri, 30 Dec 2005 23:43:24 +0100
From: Peter Zijlstra <a.p.zijlstra@xxxxxxxxx>
Re-introduce the ignore_token argument to page_referenced(); hand hot
rotation will make use of this feature.
Signed-off-by: Peter Zijlstra <a.p.zijlstra@xxxxxxxxx>
include/linux/rmap.h | 4 ++--
mm/page_replace.c | 2 +-
mm/rmap.c | 26 ++++++++++++++++----------
mm/vmscan.c | 2 +-
4 files changed, 20 insertions(+), 14 deletions(-)
Index: linux-2.6-git-2/include/linux/rmap.h
===================================================================
--- linux-2.6-git-2.orig/include/linux/rmap.h
+++ linux-2.6-git-2/include/linux/rmap.h
@@ -89,7 +89,7 @@ static inline void page_dup_rmap(struct
/*
* Called from mm/vmscan.c to handle paging out
*/
-int page_referenced(struct page *, int is_locked);
+int page_referenced(struct page *, int is_locked, int ignore_token);
int try_to_unmap(struct page *);
/*
@@ -109,7 +109,7 @@ unsigned long page_address_in_vma(struct
#define anon_vma_prepare(vma) (0)
#define anon_vma_link(vma) do {} while (0)
-#define page_referenced(page,l) TestClearPageReferenced(page)
+#define page_referenced(page,l,i) TestClearPageReferenced(page)
#define try_to_unmap(page) SWAP_FAIL
#endif /* CONFIG_MMU */
Index: linux-2.6-git-2/mm/page_replace.c
===================================================================
--- linux-2.6-git-2.orig/mm/page_replace.c
+++ linux-2.6-git-2/mm/page_replace.c
@@ -232,7 +232,7 @@ static void refill_inactive_zone(struct
if (page_mapped(page)) {
if (!reclaim_mapped ||
(total_swap_pages == 0 && PageAnon(page)) ||
- page_referenced(page, 0)) {
+ page_referenced(page, 0, 0)) {
list_add(&page->lru, &l_active);
continue;
}
Index: linux-2.6-git-2/mm/rmap.c
===================================================================
--- linux-2.6-git-2.orig/mm/rmap.c
+++ linux-2.6-git-2/mm/rmap.c
@@ -290,7 +290,7 @@ pte_t *page_check_address(struct page *p
* repeatedly from either page_referenced_anon or page_referenced_file.
*/
static int page_referenced_one(struct page *page,
- struct vm_area_struct *vma, unsigned int *mapcount)
+ struct vm_area_struct *vma, unsigned int *mapcount, int ignore_token)
{
struct mm_struct *mm = vma->vm_mm;
unsigned long address;
@@ -311,7 +311,7 @@ static int page_referenced_one(struct pa
/* Pretend the page is referenced if the task has the
swap token and is in the middle of a page fault. */
- if (mm != current->mm && has_swap_token(mm) &&
+ if (mm != current->mm && !ignore_token && has_swap_token(mm) &&
rwsem_is_locked(&mm->mmap_sem))
referenced++;
@@ -321,7 +321,7 @@ out:
return referenced;
}
-static int page_referenced_anon(struct page *page)
+static int page_referenced_anon(struct page *page, int ignore_token)
{
unsigned int mapcount;
struct anon_vma *anon_vma;
@@ -334,7 +334,8 @@ static int page_referenced_anon(struct p
mapcount = page_mapcount(page);
list_for_each_entry(vma, &anon_vma->head, anon_vma_node) {
- referenced += page_referenced_one(page, vma, &mapcount);
+ referenced += page_referenced_one(page, vma, &mapcount,
+ ignore_token);
if (!mapcount)
break;
}
@@ -353,7 +354,7 @@ static int page_referenced_anon(struct p
*
* This function is only called from page_referenced for object-based pages.
*/
-static int page_referenced_file(struct page *page)
+static int page_referenced_file(struct page *page, int ignore_token)
{
unsigned int mapcount;
struct address_space *mapping = page->mapping;
@@ -391,7 +392,8 @@ static int page_referenced_file(struct p
referenced++;
break;
}
- referenced += page_referenced_one(page, vma, &mapcount);
+ referenced += page_referenced_one(page, vma, &mapcount,
+ ignore_token);
if (!mapcount)
break;
}
@@ -408,10 +410,13 @@ static int page_referenced_file(struct p
* Quick test_and_clear_referenced for all mappings to a page,
* returns the number of ptes which referenced the page.
*/
-int page_referenced(struct page *page, int is_locked)
+int page_referenced(struct page *page, int is_locked, int ignore_token)
{
int referenced = 0;
+ if (!swap_token_default_timeout)
+ ignore_token = 1;
+
if (page_test_and_clear_young(page))
referenced++;
@@ -420,14 +425,15 @@ int page_referenced(struct page *page, i
if (page_mapped(page) && page->mapping) {
if (PageAnon(page))
- referenced += page_referenced_anon(page);
+ referenced += page_referenced_anon(page, ignore_token);
else if (is_locked)
- referenced += page_referenced_file(page);
+ referenced += page_referenced_file(page, ignore_token);
else if (TestSetPageLocked(page))
referenced++;
else {
if (page->mapping)
- referenced += page_referenced_file(page);
+ referenced += page_referenced_file(page,
+ ignore_token);
unlock_page(page);
}
}
Index: linux-2.6-git-2/mm/vmscan.c
===================================================================
--- linux-2.6-git-2.orig/mm/vmscan.c
+++ linux-2.6-git-2/mm/vmscan.c
@@ -352,7 +352,7 @@ static try_pageout_t try_pageout(struct
if (PageWriteback(page))
goto keep_locked;
- referenced = page_referenced(page, 1);
+ referenced = page_referenced(page, 1, 0);
if (referenced)
goto activate_locked;
-
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/
- References:
- [PATCH] vm: page-replace and clockpro
- From: Peter Zijlstra
- [PATCH] vm: page-replace and clockpro
- Prev by Date: [PATCH 06/14] page-replace-move-macros.patch
- Next by Date: [PATCH 03/14] page-replace-remove-sc-from-refill.patch
- Previous by thread: [PATCH 06/14] page-replace-move-macros.patch
- Next by thread: [PATCH 03/14] page-replace-remove-sc-from-refill.patch
- Index(es):
Relevant Pages
- [PATCH 27/34] mm: clockpro-ignore_token.patch
... rotation will make use of this feature. ... Called from mm/vmscan.c to
handle paging out ... (Linux-Kernel) - Re: [kvm-devel] [PATCH][RFC] SVM: Add Support for Nested Paging in AMD Fam16 CPUs
... feature of AMD QuadCore CPUs for comments and public testing. ... paging,
32 bit PAE paging and 64 bit Long Mode). ... All these guests ran successfully with these patches.
... patch series only enables NPT for 64 bit Linux hosts at the moment. ... (Linux-Kernel) - Re: Paging in Windows CE
... I think this feature is based on the Memory Mapped ... loads the corresponding
page into RAM. ... paging out executables? ... setting "Paging" for
storage manger is explained "Set to 0 ... (microsoft.public.windowsce.platbuilder) - [PATCH][RFC] SVM: Add Support for Nested Paging in AMD Fam16 CPUs
... feature of AMD QuadCore CPUs for comments and public testing. ... paging,
32 bit PAE paging and 64 bit Long Mode). ... All these guests ran successfully with these patches.
... (Linux-Kernel) - Re: New thrusty wheel.Any good?
... there isn't any indication of degrees rotation. ... > missing something?
... Since that feature is only available or desirable for maybe one or two ... (rec.autos.simulators)