[lkml]   [2005]   [Jun]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
Subject[PATCH] 2/2 swap token tuning
It turns out that the original swap token implementation, by Song
Jiang, only enforced the swap token while the task holding the
token is handling a page fault. This patch approximates that,
without adding an additional flag to the mm_struct, by checking
whether the mm->mmap_sem is held for reading, like the page
fault code does.

This patch should have the effect of automatically, and gradually,
disabling the enforcement of the swap token when there is little
or no paging going on, and "turning up" the intensity of the swap
token code the more the task holding the token is thrashing.

Thanks to Song Jiang for pointing out this aspect of the token
based thrashing control concept.

Signed-off-by: Rik van Riel

--- 2.6.12-swaptoken/mm/thrash.c.orig 2005-06-17 15:48:29.000000000 -0400
+++ 2.6.12-swaptoken/mm/thrash.c 2005-06-26 17:17:04.000000000 -0400
@@ -19,7 +19,7 @@ static unsigned long swap_token_check;
struct mm_struct * swap_token_mm = &init_mm;

* Currently disabled; Needs further code to work at HZ * 300.
--- 2.6.12-swaptoken/mm/rmap.c.orig 2005-06-26 17:16:50.000000000 -0400
+++ 2.6.12-swaptoken/mm/rmap.c 2005-06-26 17:13:17.000000000 -0400
@@ -301,7 +301,11 @@ static int page_referenced_one(struct pa
if (ptep_clear_flush_young(vma, address, pte))

- if (mm != current->mm && !ignore_token && has_swap_token(mm))
+ /* 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 && !ignore_token &&
+ has_swap_token(mm) &&
+ sem_is_read_locked(mm->mmap_sem))

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at
 \ /
  Last update: 2005-06-27 00:42    [W:0.096 / U:9.660 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site