From 374af31d43cf1fc03c558369520ae377b4ee27f3 Mon Sep 17 00:00:00 2001 From: Glauber Costa Date: Fri, 20 Jan 2012 04:57:15 +0000 Subject: [PATCH] --- yaml --- r: 286694 b: refs/heads/master c: 8cfd14ad1eb52e44cb1fe7b47a68126e45e04026 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/include/linux/res_counter.h | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/[refs] b/[refs] index 6cde9f8d894f..78cde970035c 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 376be5ff8a6a36efadd131860cf26841f366d44c +refs/heads/master: 8cfd14ad1eb52e44cb1fe7b47a68126e45e04026 diff --git a/trunk/include/linux/res_counter.h b/trunk/include/linux/res_counter.h index c9d625ca659e..d06d014afda6 100644 --- a/trunk/include/linux/res_counter.h +++ b/trunk/include/linux/res_counter.h @@ -142,7 +142,10 @@ static inline unsigned long long res_counter_margin(struct res_counter *cnt) unsigned long flags; spin_lock_irqsave(&cnt->lock, flags); - margin = cnt->limit - cnt->usage; + if (cnt->limit > cnt->usage) + margin = cnt->limit - cnt->usage; + else + margin = 0; spin_unlock_irqrestore(&cnt->lock, flags); return margin; }