> Greg Thelen wrote:
>> Replace usage of the mem_cgroup_update_file_mapped() memcg
>> statistic update routine with two new routines:
>> * mem_cgroup_inc_page_stat()
>> * mem_cgroup_dec_page_stat()
>>
>> As before, only the file_mapped statistic is managed. However,
>> these more general interfaces allow for new statistics to be
>> more easily added. New statistics are added with memcg dirty
>> page accounting.
>>
>> Signed-off-by: Greg Thelen <gthelen@google.com>
>> Signed-off-by: Andrea Righi <arighi@develer.com>
>> Acked-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
>> Acked-by: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
>> ---
>> Changelog since v1:
>> - Rename (for clarity):
>> - mem_cgroup_write_page_stat_item -> mem_cgroup_page_stat_item
>> - mem_cgroup_read_page_stat_item -> mem_cgroup_nr_pages_item
>>
>> include/linux/memcontrol.h | 31 ++++++++++++++++++++++++++++---
>> mm/memcontrol.c | 16 +++++++---------
>> mm/rmap.c | 4 ++--
>> 3 files changed, 37 insertions(+), 14 deletions(-)
>>
>> diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
>> index 159a076..067115c 100644
>> --- a/include/linux/memcontrol.h
>> +++ b/include/linux/memcontrol.h
>> @@ -25,6 +25,11 @@ struct page_cgroup;
>> struct page;
>> struct mm_struct;
>>
>> +/* Stats that can be updated by kernel. */
>> +enum mem_cgroup_page_stat_item {
>> + MEMCG_NR_FILE_MAPPED, /* # of pages charged as file rss */
>> +};
>> +
>> extern unsigned long mem_cgroup_isolate_pages(unsigned long nr_to_scan,
>> struct list_head *dst,
>> unsigned long *scanned, int order,
>> @@ -121,7 +126,22 @@ static inline bool mem_cgroup_disabled(void)
>> return false;
>> }
>>
>> -void mem_cgroup_update_file_mapped(struct page *page, int val);
>> +void mem_cgroup_update_page_stat(struct page *page,
>> + enum mem_cgroup_page_stat_item idx,
>> + int val);
>> +
>> +static inline void mem_cgroup_inc_page_stat(struct page *page,
>> + enum mem_cgroup_page_stat_item idx)
>> +{
>> + mem_cgroup_update_page_stat(page, idx, 1);
>> +}
>> +
>> +static inline void mem_cgroup_dec_page_stat(struct page *page,
>> + enum mem_cgroup_page_stat_item idx)
>> +{
>> + mem_cgroup_update_page_stat(page, idx, -1);
>> +}
>> +
>> unsigned long mem_cgroup_soft_limit_reclaim(struct zone *zone, int order,
>> gfp_t gfp_mask);
>> u64 mem_cgroup_get_limit(struct mem_cgroup *mem);
>> @@ -293,8 +313,13 @@ mem_cgroup_print_oom_info(struct mem_cgroup *memcg, struct task_struct *p)
>> {
>> }
>>
>> -static inline void mem_cgroup_update_file_mapped(struct page *page,
>> - int val)
>> +static inline void mem_cgroup_inc_page_stat(struct page *page,
>> + enum mem_cgroup_page_stat_item idx)
>> +{
>> +}
>> +
>> +static inline void mem_cgroup_dec_page_stat(struct page *page,
>> + enum mem_cgroup_page_stat_item idx)
>> {
>> }
>>
>> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
>> index 9a99cfa..4fd00c4 100644
>> --- a/mm/memcontrol.c
>> +++ b/mm/memcontrol.c
>> @@ -1592,7 +1592,8 @@ bool mem_cgroup_handle_oom(struct mem_cgroup *mem, gfp_t mask)
>> * possibility of race condition. If there is, we take a lock.
>> */
>>
>>
> Greg,
>
> I am not seeing the function mem_cgroup_update_file_stat() in the latest mmotm
> 2010-10-22-16-36.
> So not able to apply this patch. Tried couple of times cloning the entire mmotm
> git repository. But no luck.
> Tried in the web interface
http://git.zen-kernel.org/mmotm/tree/mm/memcontrol.c
> also. It is not there.
> Surprisingly git log doesn't show any recent changes to mm/memcontrol.c. Am I
> missing something?
> I could see this function in the mainline linux 2.6 git tree.
>
> -Ciju