Commit:     7faaa5f0bf4db6ac4908038e2139adc46c165ff4
Parent:     069f11f9d66bc582fb40a37a7b92363f5d321969
Author:     Mika Kukkonen <[EMAIL PROTECTED]>
AuthorDate: Thu May 10 22:22:17 2007 -0700
Committer:  Linus Torvalds <[EMAIL PROTECTED]>
CommitDate: Fri May 11 08:29:32 2007 -0700

    Bug in mm/thrash.c function grab_swap_token()
    Following bug was uncovered by compiling with '-W' flag:
      CC      mm/thrash.o
    mm/thrash.c: In function ‘grab_swap_token’:
    mm/thrash.c:52: warning: comparison of unsigned expression < 0 is always 
    Variable token_priority is unsigned, so decrementing first and then
    checking the result does not work; fixed by reversing the test, patch
    attached (compile tested only).
    I am not sure if likely() makes much sense in this new situation, but
    I'll let somebody else to make a decision on that.
    Signed-off-by: Mika Kukkonen <[EMAIL PROTECTED]>
    Cc: Rik van Riel <[EMAIL PROTECTED]>
    Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
    Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
 mm/thrash.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/mm/thrash.c b/mm/thrash.c
index 9ef9071..c4c5205 100644
--- a/mm/thrash.c
+++ b/mm/thrash.c
@@ -48,9 +48,8 @@ void grab_swap_token(void)
                if (current_interval < current->mm->last_interval)
                else {
-                       current->mm->token_priority--;
-                       if (unlikely(current->mm->token_priority < 0))
-                               current->mm->token_priority = 0;
+                       if (likely(current->mm->token_priority > 0))
+                               current->mm->token_priority--;
                /* Check if we deserve the token */
                if (current->mm->token_priority >
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at

Reply via email to