Skip to contentSkip to conversation

Swap token re-tuned

RFC PATCH New Ashwin Chaugule 1 participant 1 message Sep 28, 2006

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

RFC PATCH 2/2 Swap token re-tuned

Resending patch.

New scheme to preempt token.

include/linux/sched.h +9 -3
index 34ed0d9..417bbe4 100644
@@ -342,9 +342,15 @@ struct mm_struct {
 	/* Architecture-specific MM context */
 	mm_context_t context;
 
-	/* Token based thrashing protection. */
-	unsigned long swap_token_time;
-	char recent_pagein;
+	/* Swap token stuff */
+	/* Last value of global fault stamp as seen by this process. 
+	 * In other words, this value gives an indication of how long
+	 * it has been since this task got the token */
+	unsigned int faultstamp;
+
+       /* Deciding factor ! Increment if (global_faults - faultstamp < 5) 
+        * else decrement. High priority wins the token.*/
+	int token_priority;
 
 	/* coredumping support */
 	int core_waiters;
include/linux/swap.h +0 -1
index e7c36ba..89f8a39 100644
@@ -259,7 +259,6 @@ extern spinlock_t swap_lock;
 
 /* linux/mm/thrash.c */
 extern struct mm_struct * swap_token_mm;
-extern unsigned long swap_token_default_timeout;
 extern void grab_swap_token(void);
 extern void __put_swap_token(struct mm_struct *);
 
kernel/sysctl.c +2 -0
index fd43c3e..60e6445 100644
@@ -910,6 +910,7 @@ #ifdef HAVE_ARCH_PICK_MMAP_LAYOUT
 		.extra1		= &zero,
 	},
 #endif
+#if 0	/* Not needed anymore */
 #ifdef CONFIG_SWAP
 	{
 		.ctl_name	= VM_SWAP_TOKEN_TIMEOUT,
@@ -921,6 +922,7 @@ #ifdef CONFIG_SWAP
 		.strategy	= &sysctl_jiffies,
 	},
 #endif
+#endif
 #ifdef CONFIG_NUMA
 	{
 		.ctl_name	= VM_ZONE_RECLAIM_MODE,
mm/thrash.c +48 -60

140 lines not on this page · raw message