|
@@ -1058,19 +1058,20 @@ int __get_user_pages_fast(unsigned long start, int nr_pages, int write,
|
|
|
/*
|
|
|
* per-process(per-mm_struct) statistics.
|
|
|
*/
|
|
|
-static inline void set_mm_counter(struct mm_struct *mm, int member, long value)
|
|
|
-{
|
|
|
- atomic_long_set(&mm->rss_stat.count[member], value);
|
|
|
-}
|
|
|
-
|
|
|
-#if defined(SPLIT_RSS_COUNTING)
|
|
|
-unsigned long get_mm_counter(struct mm_struct *mm, int member);
|
|
|
-#else
|
|
|
static inline unsigned long get_mm_counter(struct mm_struct *mm, int member)
|
|
|
{
|
|
|
- return atomic_long_read(&mm->rss_stat.count[member]);
|
|
|
-}
|
|
|
+ long val = atomic_long_read(&mm->rss_stat.count[member]);
|
|
|
+
|
|
|
+#ifdef SPLIT_RSS_COUNTING
|
|
|
+ /*
|
|
|
+ * counter is updated in asynchronous manner and may go to minus.
|
|
|
+ * But it's never be expected number for users.
|
|
|
+ */
|
|
|
+ if (val < 0)
|
|
|
+ val = 0;
|
|
|
#endif
|
|
|
+ return (unsigned long)val;
|
|
|
+}
|
|
|
|
|
|
static inline void add_mm_counter(struct mm_struct *mm, int member, long value)
|
|
|
{
|