Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 292620
b: refs/heads/master
c: 69c9782
h: refs/heads/master
v: v3
  • Loading branch information
Konstantin Khlebnikov authored and Linus Torvalds committed Mar 22, 2012
1 parent c5e6f91 commit 12a66de
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 29 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 6131728914810a6c02e08750e13e45870101e862
refs/heads/master: 69c978232aaa99476f9bd002c2a29a84fa3779b5
21 changes: 11 additions & 10 deletions trunk/include/linux/mm.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
18 changes: 0 additions & 18 deletions trunk/mm/memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -160,24 +160,6 @@ static void check_sync_rss_stat(struct task_struct *task)
__sync_task_rss_stat(task, task->mm);
}

unsigned long get_mm_counter(struct mm_struct *mm, int member)
{
long val = 0;

/*
* Don't use task->mm here...for avoiding to use task_get_mm()..
* The caller must guarantee task->mm is not invalid.
*/
val = atomic_long_read(&mm->rss_stat.count[member]);
/*
* counter is updated in asynchronous manner and may go to minus.
* But it's never be expected number for users.
*/
if (val < 0)
return 0;
return (unsigned long)val;
}

void sync_mm_rss(struct task_struct *task, struct mm_struct *mm)
{
__sync_task_rss_stat(task, mm);
Expand Down

0 comments on commit 12a66de

Please sign in to comment.