[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen master] xen: credit: change an ASSERT on nr_runnable so that it makes sense.



commit 341569f1d18df00bda6625a77c2b106cee382562
Author:     Dario Faggioli <dario.faggioli@xxxxxxxxxx>
AuthorDate: Thu Apr 13 09:49:54 2017 +0200
Commit:     George Dunlap <george.dunlap@xxxxxxxxxx>
CommitDate: Thu Apr 13 15:10:54 2017 +0100

    xen: credit: change an ASSERT on nr_runnable so that it makes sense.
    
    Since the counter is unsigned, it's pointless/bogous to check
    for if to be above zero.
    
    Check that it is at least one before it's decremented, instead.
    
    Spotted by Coverity.
    
    Reported-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    Signed-off-by: Dario Faggioli <dario.faggioli@xxxxxxxxxx>
    Reviewed-by: George Dunlap <george.dunlap@xxxxxxxxxx>
    Release-acked-by: Julien Grall <julien.grall@xxxxxxx>
---
 xen/common/sched_credit.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/common/sched_credit.c b/xen/common/sched_credit.c
index 93658dc..efdf6bf 100644
--- a/xen/common/sched_credit.c
+++ b/xen/common/sched_credit.c
@@ -275,8 +275,8 @@ static inline void
 dec_nr_runnable(unsigned int cpu)
 {
     ASSERT(spin_is_locked(per_cpu(schedule_data, cpu).schedule_lock));
+    ASSERT(CSCHED_PCPU(cpu)->nr_runnable >= 1);
     CSCHED_PCPU(cpu)->nr_runnable--;
-    ASSERT(CSCHED_PCPU(cpu)->nr_runnable >= 0);
 }
 
 static inline void
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.