Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=2b46b5673ca67d23302c2afac045def988a3cade
Commit:     2b46b5673ca67d23302c2afac045def988a3cade
Parent:     c443acab2eebf12dce7e78fe29e76786f55ad1be
Author:     Michael Neuling <[EMAIL PROTECTED]>
AuthorDate: Tue Nov 20 15:18:40 2007 +1100
Committer:  Paul Mackerras <[EMAIL PROTECTED]>
CommitDate: Tue Nov 20 16:10:28 2007 +1100

    [POWERPC] Fix possible division by zero in scaled time accounting
    
    If we get no user time and no system time allocated since the last
    account_system_vtime, the system to user time ratio estimate can end
    up dividing by zero.
    
    This was causing a problem noticed by Balbir Singh.
    
    Signed-off-by: Michael Neuling <[EMAIL PROTECTED]>
    Signed-off-by: Paul Mackerras <[EMAIL PROTECTED]>
---
 arch/powerpc/kernel/time.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c
index c0d7772..a925a8e 100644
--- a/arch/powerpc/kernel/time.c
+++ b/arch/powerpc/kernel/time.c
@@ -241,8 +241,9 @@ void account_system_vtime(struct task_struct *tsk)
                /* deltascaled includes both user and system time.
                 * Hence scale it based on the purr ratio to estimate
                 * the system time */
-               deltascaled = deltascaled * get_paca()->system_time /
-                       (get_paca()->system_time + get_paca()->user_time);
+               if (get_paca()->user_time)
+                       deltascaled = deltascaled * get_paca()->system_time /
+                            (get_paca()->system_time + get_paca()->user_time);
                delta += get_paca()->system_time;
                get_paca()->system_time = 0;
        }
-
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  http://vger.kernel.org/majordomo-info.html

Reply via email to