On Wed, Mar 10, 2010 at 12:00:35AM +0100, Andrea Righi wrote: [..] > - * Currently used to update mapped file statistics, but the routine can be > - * generalized to update other statistics as well. > + * mem_cgroup_update_page_stat() - update memcg file cache's accounting > + * @page: the page involved in a file cache operation. > + * @idx: the particular file cache statistic. > + * @charge: true to increment, false to decrement the statistic specified > + * by @idx. > + * > + * Update memory cgroup file cache's accounting. > */ > -void mem_cgroup_update_file_mapped(struct page *page, int val) > +void mem_cgroup_update_page_stat(struct page *page, > + enum mem_cgroup_write_page_stat_item idx, bool charge) > { > - struct mem_cgroup *mem; > struct page_cgroup *pc; > unsigned long flags; > > + if (mem_cgroup_disabled()) > + return; > pc = lookup_page_cgroup(page); > - if (unlikely(!pc)) > + if (unlikely(!pc) || !PageCgroupUsed(pc)) > return; > - > lock_page_cgroup(pc, flags); > - mem = pc->mem_cgroup; > - if (!mem) > - goto done; > - > - if (!PageCgroupUsed(pc)) > - goto done; > - > - /* > - * Preemption is already disabled. We can use __this_cpu_xxx > - */ > - __this_cpu_add(mem->stat->count[MEM_CGROUP_STAT_FILE_MAPPED], val); > - > -done: > + __mem_cgroup_update_page_stat(pc, idx, charge); > unlock_page_cgroup(pc, flags); > } > +EXPORT_SYMBOL_GPL(mem_cgroup_update_page_stat_unlocked); CC mm/memcontrol.o mm/memcontrol.c:1600: error: ‘mem_cgroup_update_page_stat_unlocked’ undeclared here (not in a function) mm/memcontrol.c:1600: warning: type defaults to ‘int’ in declaration of ‘mem_cgroup_update_page_stat_unlocked’ make[1]: *** [mm/memcontrol.o] Error 1 make: *** [mm] Error 2 Thanks Vivek -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@xxxxxxxxxx For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@xxxxxxxxx"> email@xxxxxxxxx </a>