aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorAshwin Chaugule <ashwin.chaugule@celunite.com>2006-12-06 23:31:57 -0500
committerLinus Torvalds <torvalds@woody.osdl.org>2006-12-07 11:39:21 -0500
commit7602bdf2fd14a40dd9b104e516fdc05e1bd17952 (patch)
tree5ca703b0a95f6f2e6d977c816532b9085f453974 /kernel
parent098fe651f7e9d759d1117c78c1a642b9b3945922 (diff)
[PATCH] new scheme to preempt swap token
The new swap token patches replace the current token traversal algo. The old algo had a crude timeout parameter that was used to handover the token from one task to another. This algo, transfers the token to the tasks that are in need of the token. The urgency for the token is based on the number of times a task is required to swap-in pages. Accordingly, the priority of a task is incremented if it has been badly affected due to swap-outs. To ensure that the token doesnt bounce around rapidly, the token holders are given a priority boost. The priority of tasks is also decremented, if their rate of swap-in's keeps reducing. This way, the condition to check whether to pre-empt the swap token, is a matter of comparing two task's priority fields. [akpm@osdl.org: cleanups] Signed-off-by: Ashwin Chaugule <ashwin.chaugule@celunite.com> Cc: Rik van Riel <riel@redhat.com> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/fork.c8
-rw-r--r--kernel/sysctl.c11
2 files changed, 8 insertions, 11 deletions
diff --git a/kernel/fork.c b/kernel/fork.c
index 8cdd3e72ba55..5678e6c61ef2 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -479,6 +479,10 @@ static struct mm_struct *dup_mm(struct task_struct *tsk)
479 479
480 memcpy(mm, oldmm, sizeof(*mm)); 480 memcpy(mm, oldmm, sizeof(*mm));
481 481
482 /* Initializing for Swap token stuff */
483 mm->token_priority = 0;
484 mm->last_interval = 0;
485
482 if (!mm_init(mm)) 486 if (!mm_init(mm))
483 goto fail_nomem; 487 goto fail_nomem;
484 488
@@ -542,6 +546,10 @@ static int copy_mm(unsigned long clone_flags, struct task_struct * tsk)
542 goto fail_nomem; 546 goto fail_nomem;
543 547
544good_mm: 548good_mm:
549 /* Initializing for Swap token stuff */
550 mm->token_priority = 0;
551 mm->last_interval = 0;
552
545 tsk->mm = mm; 553 tsk->mm = mm;
546 tsk->active_mm = mm; 554 tsk->active_mm = mm;
547 return 0; 555 return 0;
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 09e569f4792b..7abe9704e75a 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -977,17 +977,6 @@ static ctl_table vm_table[] = {
977 .extra1 = &zero, 977 .extra1 = &zero,
978 }, 978 },
979#endif 979#endif
980#ifdef CONFIG_SWAP
981 {
982 .ctl_name = VM_SWAP_TOKEN_TIMEOUT,
983 .procname = "swap_token_timeout",
984 .data = &swap_token_default_timeout,
985 .maxlen = sizeof(swap_token_default_timeout),
986 .mode = 0644,
987 .proc_handler = &proc_dointvec_jiffies,
988 .strategy = &sysctl_jiffies,
989 },
990#endif
991#ifdef CONFIG_NUMA 980#ifdef CONFIG_NUMA
992 { 981 {
993 .ctl_name = VM_ZONE_RECLAIM_MODE, 982 .ctl_name = VM_ZONE_RECLAIM_MODE,