diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 5ca1dcf77ce985bac6d493acb2e63c8c6b5d9af9..c6bd28edd533217c818a7e43f24e11ec191c37d2 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -5591,7 +5591,13 @@ static int compare_thresholds(const void *a, const void *b)
 	const struct mem_cgroup_threshold *_a = a;
 	const struct mem_cgroup_threshold *_b = b;
 
-	return _a->threshold - _b->threshold;
+	if (_a->threshold > _b->threshold)
+		return 1;
+
+	if (_a->threshold < _b->threshold)
+		return -1;
+
+	return 0;
 }
 
 static int mem_cgroup_oom_notify_cb(struct mem_cgroup *memcg)