lkml.org 
[lkml]   [2010]   [Nov]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] memcg: mark mem_cgroup_page_stat() underflow unlikely
Date
Add unlikely() to indicate that underflow of per-cpu counter
sum is not expected.

The underflow is already handled, but should have been
marked unlikely.

Reported-by: Wu Fengguang <fengguang.wu@intel.com>
Signed-off-by: Greg Thelen <gthelen@google.com>
---
mm/memcontrol.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index ed070d0..e8fbade 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -1393,7 +1393,7 @@ unsigned long mem_cgroup_page_stat(struct mem_cgroup *mem,
* value. This function returns an unsigned value, so round it up to
* zero to avoid returning a very large value.
*/
- if (value < 0)
+ if (unlikely(value < 0))
value = 0;

put_online_cpus();
--
1.7.3.1


\
 
 \ /
  Last update: 2010-11-09 21:27    [W:0.014 / U:0.088 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site