From: Andrew Morton Cc: Ashwin Chaugule Cc: Rik van Riel Cc: Peter Zijlstra Signed-off-by: Andrew Morton --- mm/thrash.c | 20 ++++++++++---------- 1 files changed, 10 insertions(+), 10 deletions(-) diff -puN mm/thrash.c~new-scheme-to-preempt-swap-token-tidy mm/thrash.c --- a/mm/thrash.c~new-scheme-to-preempt-swap-token-tidy +++ a/mm/thrash.c @@ -23,12 +23,12 @@ #include static DEFINE_SPINLOCK(swap_token_lock); -struct mm_struct * swap_token_mm = NULL; -unsigned int global_faults = 0; +struct mm_struct *swap_token_mm; +unsigned int global_faults; void grab_swap_token(void) { - int current_interval = 0; + int current_interval; global_faults++; @@ -53,14 +53,15 @@ void grab_swap_token(void) current->mm->token_priority = 0; } /* Check if we deserve the token */ - if (current->mm->token_priority > swap_token_mm->token_priority) { - current->mm->token_priority = current->mm->token_priority + 2; + if (current->mm->token_priority > + swap_token_mm->token_priority) { + current->mm->token_priority += 2; swap_token_mm = current->mm; } - } - else + } else { /* Token holder came in again! */ - current->mm->token_priority = current->mm->token_priority + 2; + current->mm->token_priority += 2; + } out: current->mm->faultstamp = global_faults; @@ -73,8 +74,7 @@ return; void __put_swap_token(struct mm_struct *mm) { spin_lock(&swap_token_lock); - if (likely(mm == swap_token_mm)) { + if (likely(mm == swap_token_mm)) swap_token_mm = NULL; - } spin_unlock(&swap_token_lock); } _