[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>
This commit is contained in:
committed by
Linus Torvalds
parent
098fe651f7
commit
7602bdf2fd
@@ -479,6 +479,10 @@ static struct mm_struct *dup_mm(struct task_struct *tsk)
|
||||
|
||||
memcpy(mm, oldmm, sizeof(*mm));
|
||||
|
||||
/* Initializing for Swap token stuff */
|
||||
mm->token_priority = 0;
|
||||
mm->last_interval = 0;
|
||||
|
||||
if (!mm_init(mm))
|
||||
goto fail_nomem;
|
||||
|
||||
@@ -542,6 +546,10 @@ static int copy_mm(unsigned long clone_flags, struct task_struct * tsk)
|
||||
goto fail_nomem;
|
||||
|
||||
good_mm:
|
||||
/* Initializing for Swap token stuff */
|
||||
mm->token_priority = 0;
|
||||
mm->last_interval = 0;
|
||||
|
||||
tsk->mm = mm;
|
||||
tsk->active_mm = mm;
|
||||
return 0;
|
||||
|
@@ -977,17 +977,6 @@ static ctl_table vm_table[] = {
|
||||
.extra1 = &zero,
|
||||
},
|
||||
#endif
|
||||
#ifdef CONFIG_SWAP
|
||||
{
|
||||
.ctl_name = VM_SWAP_TOKEN_TIMEOUT,
|
||||
.procname = "swap_token_timeout",
|
||||
.data = &swap_token_default_timeout,
|
||||
.maxlen = sizeof(swap_token_default_timeout),
|
||||
.mode = 0644,
|
||||
.proc_handler = &proc_dointvec_jiffies,
|
||||
.strategy = &sysctl_jiffies,
|
||||
},
|
||||
#endif
|
||||
#ifdef CONFIG_NUMA
|
||||
{
|
||||
.ctl_name = VM_ZONE_RECLAIM_MODE,
|
||||
|
Reference in New Issue
Block a user