[Devel] Re: [PATCH -mmotm 4/5] memcg: dirty pages accounting and limiting infrastructure

2010-03-30 Thread Andrea Righi
On Wed, Mar 10, 2010 at 05:23:39PM -0500, Vivek Goyal wrote:
 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! Will fix in the next version.

(mmh... why I didn't see this? probably because I'm building a static kernel...)

-Andrea
___
Containers mailing list
contain...@lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/containers

___
Devel mailing list
Devel@openvz.org
https://openvz.org/mailman/listinfo/devel


[Devel] Re: [PATCH -mmotm 4/5] memcg: dirty pages accounting and limiting infrastructure

2010-03-30 Thread Andrea Righi
On Tue, Mar 16, 2010 at 10:11:50AM -0400, Vivek Goyal wrote:
 On Tue, Mar 16, 2010 at 11:32:38AM +0900, Daisuke Nishimura wrote:
 
 [..]
   + * mem_cgroup_page_stat() - get memory cgroup file cache statistics
   + * @item:memory statistic item exported to the kernel
   + *
   + * Return the accounted statistic value, or a negative value in case of 
   error.
   + */
   +s64 mem_cgroup_page_stat(enum mem_cgroup_read_page_stat_item item)
   +{
   + struct mem_cgroup_page_stat stat = {};
   + struct mem_cgroup *mem;
   +
   + rcu_read_lock();
   + mem = mem_cgroup_from_task(current);
   + if (mem  !mem_cgroup_is_root(mem)) {
   + /*
   +  * If we're looking for dirtyable pages we need to evaluate
   +  * free pages depending on the limit and usage of the parents
   +  * first of all.
   +  */
   + if (item == MEMCG_NR_DIRTYABLE_PAGES)
   + stat.value = memcg_get_hierarchical_free_pages(mem);
   + /*
   +  * Recursively evaluate page statistics against all cgroup
   +  * under hierarchy tree
   +  */
   + stat.item = item;
   + mem_cgroup_walk_tree(mem, stat, mem_cgroup_page_stat_cb);
   + } else
   + stat.value = -EINVAL;
   + rcu_read_unlock();
   +
   + return stat.value;
   +}
   +
  hmm, mem_cgroup_page_stat() can return negative value, but you place 
  BUG_ON()
  in [5/5] to check it returns negative value. What happens if the current is 
  moved
  to root between mem_cgroup_has_dirty_limit() and mem_cgroup_page_stat() ?
  How about making mem_cgroup_has_dirty_limit() return the target mem_cgroup, 
  and
  passing the mem_cgroup to mem_cgroup_page_stat() ?
  
 
 Hmm, if mem_cgroup_has_dirty_limit() retrun pointer to memcg, then one
 shall have to use rcu_read_lock() and that will look ugly.
 
 Why don't we simply look at the return value and if it is negative, we
 fall back to using global stats and get rid of BUG_ON()?

I vote for this one. IMHO the caller of mem_cgroup_page_stat() should
fallback to the equivalent global stats. This allows to keep the things
separated and put in mm/memcontrol.c only the memcg stuff.

 
 Or, modify mem_cgroup_page_stat() to return global stats if it can't
 determine per cgroup stat for some reason. (mem=NULL or root cgroup etc).
 
 Vivek

Thanks,
-Andrea
___
Containers mailing list
contain...@lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/containers

___
Devel mailing list
Devel@openvz.org
https://openvz.org/mailman/listinfo/devel


[Devel] Re: [PATCH -mmotm 4/5] memcg: dirty pages accounting and limiting infrastructure

2010-03-30 Thread Andrea Righi
On Tue, Mar 16, 2010 at 11:32:38AM +0900, Daisuke Nishimura wrote:
[snip]
  @@ -3190,10 +3512,14 @@ struct {
   } memcg_stat_strings[NR_MCS_STAT] = {
  {cache, total_cache},
  {rss, total_rss},
  -   {mapped_file, total_mapped_file},
  {pgpgin, total_pgpgin},
  {pgpgout, total_pgpgout},
  {swap, total_swap},
  +   {mapped_file, total_mapped_file},
  +   {filedirty, dirty_pages},
  +   {writeback, writeback_pages},
  +   {writeback_tmp, writeback_temp_pages},
  +   {nfs, nfs_unstable},
  {inactive_anon, total_inactive_anon},
  {active_anon, total_active_anon},
  {inactive_file, total_inactive_file},
 Why not using total_xxx for total_name ?

Agreed. I would be definitely more clear. Balbir, KAME-san, what do you
think?

 
  @@ -3212,8 +3538,6 @@ static int mem_cgroup_get_local_stat(struct 
  mem_cgroup *mem, void *data)
  s-stat[MCS_CACHE] += val * PAGE_SIZE;
  val = mem_cgroup_read_stat(mem, MEM_CGROUP_STAT_RSS);
  s-stat[MCS_RSS] += val * PAGE_SIZE;
  -   val = mem_cgroup_read_stat(mem, MEM_CGROUP_STAT_FILE_MAPPED);
  -   s-stat[MCS_FILE_MAPPED] += val * PAGE_SIZE;
  val = mem_cgroup_read_stat(mem, MEM_CGROUP_STAT_PGPGIN_COUNT);
  s-stat[MCS_PGPGIN] += val;
  val = mem_cgroup_read_stat(mem, MEM_CGROUP_STAT_PGPGOUT_COUNT);
  @@ -3222,6 +3546,16 @@ static int mem_cgroup_get_local_stat(struct 
  mem_cgroup *mem, void *data)
  val = mem_cgroup_read_stat(mem, MEM_CGROUP_STAT_SWAPOUT);
  s-stat[MCS_SWAP] += val * PAGE_SIZE;
  }
  +   val = mem_cgroup_read_stat(mem, MEM_CGROUP_STAT_FILE_MAPPED);
  +   s-stat[MCS_FILE_MAPPED] += val * PAGE_SIZE;
  +   val = mem_cgroup_read_stat(mem, MEM_CGROUP_STAT_FILE_DIRTY);
  +   s-stat[MCS_FILE_DIRTY] += val;
  +   val = mem_cgroup_read_stat(mem, MEM_CGROUP_STAT_WRITEBACK);
  +   s-stat[MCS_WRITEBACK] += val;
  +   val = mem_cgroup_read_stat(mem, MEM_CGROUP_STAT_WRITEBACK_TEMP);
  +   s-stat[MCS_WRITEBACK_TEMP] += val;
  +   val = mem_cgroup_read_stat(mem, MEM_CGROUP_STAT_UNSTABLE_NFS);
  +   s-stat[MCS_UNSTABLE_NFS] += val;
   
 I don't have a strong objection, but I prefer showing them in bytes.
 And can you add to mem_cgroup_stat_show() something like:
 
   for (i = 0; i  NR_MCS_STAT; i++) {
   if (i == MCS_SWAP  !do_swap_account)
   continue;
 + if (i = MCS_FILE_STAT_STAR  i = MCS_FILE_STAT_END 
 +mem_cgroup_is_root(mem_cont))
 + continue;
   cb-fill(cb, memcg_stat_strings[i].local_name, mystat.stat[i]);
   }

I like this. And I also prefer to show these values in bytes.

 
 not to show file stat in root cgroup ? It's meaningless value anyway.
 Of course, you'd better mention it in [2/5] too.

OK.

Thanks,
-Andrea
___
Containers mailing list
contain...@lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/containers

___
Devel mailing list
Devel@openvz.org
https://openvz.org/mailman/listinfo/devel


[Devel] Re: [PATCH -mmotm 4/5] memcg: dirty pages accounting and limiting infrastructure

2010-03-30 Thread Greg Thelen
I have a proposed change to [PATCH -mmotm 4/5] memcg: dirty pages accounting
and limiting infrastructure v6.  The change is small and I am presenting it
as a git patch (below) to be applied after 4/5 v6 has been applied.
The change is fairly simple.  An alternative would be to reject my
patch (below) and enhance get_vm_dirty_param() to loop for consistenty in all
cases.

---patch snip here, rest of email is git patch of 4/5 v6 ---

Removed unneeded looping from get_vm_dirty_param().  The only caller of
get_vm_dirty_param() gracefully handles inconsistent values, so there is no
need for get_vm_dirty_param() to loop to ensure consistency.  The previous
looping was inconsistent because it did not loop for the case where memory
cgroups were disabled.

Signed-off-by: Greg Thelen gthe...@google.com
---
 mm/memcontrol.c |   28 
 1 files changed, 12 insertions(+), 16 deletions(-)

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 4d00c0f..990a907 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -1081,6 +1081,10 @@ static void __mem_cgroup_get_dirty_param(struct 
vm_dirty_param *param,
  * The function fills @param with the current memcg dirty memory settings. If
  * memory cgroup is disabled or in case of error the structure is filled with
  * the global dirty memory settings.
+ *
+ * Because global and memcg vm_dirty_param are not protected, inconsistent
+ * values may be returned.  If consistent values are required, then the caller
+ * should call this routine until dirty_param_is_valid() returns true.
  */
 void get_vm_dirty_param(struct vm_dirty_param *param)
 {
@@ -1090,28 +1094,20 @@ void get_vm_dirty_param(struct vm_dirty_param *param)
get_global_vm_dirty_param(param);
return;
}
+
/*
 * It's possible that current may be moved to other cgroup while we
 * access cgroup. But precise check is meaningless because the task can
 * be moved after our access and writeback tends to take long time.
 * At least, memcg will not be freed under rcu_read_lock().
 */
-   while (1) {
-   rcu_read_lock();
-   memcg = mem_cgroup_from_task(current);
-   if (likely(memcg))
-   __mem_cgroup_get_dirty_param(param, memcg);
-   else
-   get_global_vm_dirty_param(param);
-   rcu_read_unlock();
-   /*
-* Since global and memcg vm_dirty_param are not protected we
-* try to speculatively read them and retry if we get
-* inconsistent values.
-*/
-   if (likely(dirty_param_is_valid(param)))
-   break;
-   }
+   rcu_read_lock();
+   memcg = mem_cgroup_from_task(current);
+   if (likely(memcg))
+   __mem_cgroup_get_dirty_param(param, memcg);
+   else
+   get_global_vm_dirty_param(param);
+   rcu_read_unlock();
 }
 
 /*
-- 
1.7.0.1

___
Containers mailing list
contain...@lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/containers

___
Devel mailing list
Devel@openvz.org
https://openvz.org/mailman/listinfo/devel


[Devel] Re: [PATCH -mmotm 4/5] memcg: dirty pages accounting and limiting infrastructure

2010-03-16 Thread Vivek Goyal
On Tue, Mar 16, 2010 at 11:32:38AM +0900, Daisuke Nishimura wrote:

[..]
  + * mem_cgroup_page_stat() - get memory cgroup file cache statistics
  + * @item:  memory statistic item exported to the kernel
  + *
  + * Return the accounted statistic value, or a negative value in case of 
  error.
  + */
  +s64 mem_cgroup_page_stat(enum mem_cgroup_read_page_stat_item item)
  +{
  +   struct mem_cgroup_page_stat stat = {};
  +   struct mem_cgroup *mem;
  +
  +   rcu_read_lock();
  +   mem = mem_cgroup_from_task(current);
  +   if (mem  !mem_cgroup_is_root(mem)) {
  +   /*
  +* If we're looking for dirtyable pages we need to evaluate
  +* free pages depending on the limit and usage of the parents
  +* first of all.
  +*/
  +   if (item == MEMCG_NR_DIRTYABLE_PAGES)
  +   stat.value = memcg_get_hierarchical_free_pages(mem);
  +   /*
  +* Recursively evaluate page statistics against all cgroup
  +* under hierarchy tree
  +*/
  +   stat.item = item;
  +   mem_cgroup_walk_tree(mem, stat, mem_cgroup_page_stat_cb);
  +   } else
  +   stat.value = -EINVAL;
  +   rcu_read_unlock();
  +
  +   return stat.value;
  +}
  +
 hmm, mem_cgroup_page_stat() can return negative value, but you place BUG_ON()
 in [5/5] to check it returns negative value. What happens if the current is 
 moved
 to root between mem_cgroup_has_dirty_limit() and mem_cgroup_page_stat() ?
 How about making mem_cgroup_has_dirty_limit() return the target mem_cgroup, 
 and
 passing the mem_cgroup to mem_cgroup_page_stat() ?
 

Hmm, if mem_cgroup_has_dirty_limit() retrun pointer to memcg, then one
shall have to use rcu_read_lock() and that will look ugly.

Why don't we simply look at the return value and if it is negative, we
fall back to using global stats and get rid of BUG_ON()?

Or, modify mem_cgroup_page_stat() to return global stats if it can't
determine per cgroup stat for some reason. (mem=NULL or root cgroup etc).

Vivek
___
Containers mailing list
contain...@lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/containers

___
Devel mailing list
Devel@openvz.org
https://openvz.org/mailman/listinfo/devel


[Devel] Re: [PATCH -mmotm 4/5] memcg: dirty pages accounting and limiting infrastructure

2010-03-16 Thread Daisuke Nishimura
On Tue, 16 Mar 2010 10:11:50 -0400
Vivek Goyal vgo...@redhat.com wrote:

 On Tue, Mar 16, 2010 at 11:32:38AM +0900, Daisuke Nishimura wrote:
 
 [..]
   + * mem_cgroup_page_stat() - get memory cgroup file cache statistics
   + * @item:memory statistic item exported to the kernel
   + *
   + * Return the accounted statistic value, or a negative value in case of 
   error.
   + */
   +s64 mem_cgroup_page_stat(enum mem_cgroup_read_page_stat_item item)
   +{
   + struct mem_cgroup_page_stat stat = {};
   + struct mem_cgroup *mem;
   +
   + rcu_read_lock();
   + mem = mem_cgroup_from_task(current);
   + if (mem  !mem_cgroup_is_root(mem)) {
   + /*
   +  * If we're looking for dirtyable pages we need to evaluate
   +  * free pages depending on the limit and usage of the parents
   +  * first of all.
   +  */
   + if (item == MEMCG_NR_DIRTYABLE_PAGES)
   + stat.value = memcg_get_hierarchical_free_pages(mem);
   + /*
   +  * Recursively evaluate page statistics against all cgroup
   +  * under hierarchy tree
   +  */
   + stat.item = item;
   + mem_cgroup_walk_tree(mem, stat, mem_cgroup_page_stat_cb);
   + } else
   + stat.value = -EINVAL;
   + rcu_read_unlock();
   +
   + return stat.value;
   +}
   +
  hmm, mem_cgroup_page_stat() can return negative value, but you place 
  BUG_ON()
  in [5/5] to check it returns negative value. What happens if the current is 
  moved
  to root between mem_cgroup_has_dirty_limit() and mem_cgroup_page_stat() ?
  How about making mem_cgroup_has_dirty_limit() return the target mem_cgroup, 
  and
  passing the mem_cgroup to mem_cgroup_page_stat() ?
  
 
 Hmm, if mem_cgroup_has_dirty_limit() retrun pointer to memcg, then one
 shall have to use rcu_read_lock() and that will look ugly.
 
agreed.

 Why don't we simply look at the return value and if it is negative, we
 fall back to using global stats and get rid of BUG_ON()?
 
 Or, modify mem_cgroup_page_stat() to return global stats if it can't
 determine per cgroup stat for some reason. (mem=NULL or root cgroup etc).
 
I don't have any objection as long as we don't hit BUG_ON.


Thanks,
Daisuke Nishimura.

 Vivek
 
 --
 To unsubscribe, send a message with 'unsubscribe linux-mm' in
 the body to majord...@kvack.org.  For more info on Linux MM,
 see: http://www.linux-mm.org/ .
 Don't email: a href=mailto:d...@kvack.org; em...@kvack.org /a
 



___
Containers mailing list
contain...@lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/containers

___
Devel mailing list
Devel@openvz.org
https://openvz.org/mailman/listinfo/devel


[Devel] Re: [PATCH -mmotm 4/5] memcg: dirty pages accounting and limiting infrastructure

2010-03-15 Thread Daisuke Nishimura
On Mon, 15 Mar 2010 00:26:41 +0100, Andrea Righi ari...@develer.com wrote:
 Infrastructure to account dirty pages per cgroup and add dirty limit
 interfaces in the cgroupfs:
 
  - Direct write-out: memory.dirty_ratio, memory.dirty_bytes
 
  - Background write-out: memory.dirty_background_ratio, 
 memory.dirty_background_bytes
 
 Signed-off-by: Andrea Righi ari...@develer.com
 ---
  include/linux/memcontrol.h |   92 -
  mm/memcontrol.c|  484 
 +---
  2 files changed, 540 insertions(+), 36 deletions(-)
 
 diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
 index 88d3f9e..0602ec9 100644
 --- a/include/linux/memcontrol.h
 +++ b/include/linux/memcontrol.h
 @@ -19,12 +19,55 @@
  
  #ifndef _LINUX_MEMCONTROL_H
  #define _LINUX_MEMCONTROL_H
 +
 +#include linux/writeback.h
  #include linux/cgroup.h
 +
  struct mem_cgroup;
  struct page_cgroup;
  struct page;
  struct mm_struct;
  
 +/* Cgroup memory statistics items exported to the kernel */
 +enum mem_cgroup_read_page_stat_item {
 + MEMCG_NR_DIRTYABLE_PAGES,
 + MEMCG_NR_RECLAIM_PAGES,
 + MEMCG_NR_WRITEBACK,
 + MEMCG_NR_DIRTY_WRITEBACK_PAGES,
 +};
 +
 +/* File cache pages accounting */
 +enum mem_cgroup_write_page_stat_item {
 + MEMCG_NR_FILE_MAPPED,   /* # of pages charged as file rss */
 + MEMCG_NR_FILE_DIRTY,/* # of dirty pages in page cache */
 + MEMCG_NR_FILE_WRITEBACK,/* # of pages under writeback */
 + MEMCG_NR_FILE_WRITEBACK_TEMP,   /* # of pages under writeback using
 +temporary buffers */
 + MEMCG_NR_FILE_UNSTABLE_NFS, /* # of NFS unstable pages */
 +
 + MEMCG_NR_FILE_NSTAT,
 +};
 +
 +/* Dirty memory parameters */
 +struct vm_dirty_param {
 + int dirty_ratio;
 + int dirty_background_ratio;
 + unsigned long dirty_bytes;
 + unsigned long dirty_background_bytes;
 +};
 +
 +/*
 + * TODO: provide a validation check routine. And retry if validation
 + * fails.
 + */
 +static inline void get_global_vm_dirty_param(struct vm_dirty_param *param)
 +{
 + param-dirty_ratio = vm_dirty_ratio;
 + param-dirty_bytes = vm_dirty_bytes;
 + param-dirty_background_ratio = dirty_background_ratio;
 + param-dirty_background_bytes = dirty_background_bytes;
 +}
 +
  #ifdef CONFIG_CGROUP_MEM_RES_CTLR
  /*
   * All charge functions with gfp_mask should use GFP_KERNEL or
 @@ -117,6 +160,25 @@ extern void mem_cgroup_print_oom_info(struct mem_cgroup 
 *memcg,
  extern int do_swap_account;
  #endif
  
 +extern bool mem_cgroup_has_dirty_limit(void);
 +extern void get_vm_dirty_param(struct vm_dirty_param *param);
 +extern s64 mem_cgroup_page_stat(enum mem_cgroup_read_page_stat_item item);
 +
 +extern void mem_cgroup_update_page_stat(struct page *page,
 + enum mem_cgroup_write_page_stat_item idx, bool charge);
 +
 +static inline void mem_cgroup_inc_page_stat(struct page *page,
 + enum mem_cgroup_write_page_stat_item idx)
 +{
 + mem_cgroup_update_page_stat(page, idx, true);
 +}
 +
 +static inline void mem_cgroup_dec_page_stat(struct page *page,
 + enum mem_cgroup_write_page_stat_item idx)
 +{
 + mem_cgroup_update_page_stat(page, idx, false);
 +}
 +
  static inline bool mem_cgroup_disabled(void)
  {
   if (mem_cgroup_subsys.disabled)
 @@ -124,12 +186,6 @@ static inline bool mem_cgroup_disabled(void)
   return false;
  }
  
 -enum mem_cgroup_page_stat_item {
 - MEMCG_NR_FILE_MAPPED,
 - MEMCG_NR_FILE_NSTAT,
 -};
 -
 -void mem_cgroup_update_stat(struct page *page, int idx, bool charge);
  unsigned long mem_cgroup_soft_limit_reclaim(struct zone *zone, int order,
   gfp_t gfp_mask, int nid,
   int zid);
 @@ -299,8 +355,18 @@ 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 s64 mem_cgroup_page_stat(enum mem_cgroup_read_page_stat_item 
 item)
 +{
 + return -ENOSYS;
 +}
 +
 +static inline void mem_cgroup_inc_page_stat(struct page *page,
 + enum mem_cgroup_write_page_stat_item idx)
 +{
 +}
 +
 +static inline void mem_cgroup_dec_page_stat(struct page *page,
 + enum mem_cgroup_write_page_stat_item idx)
  {
  }
  
 @@ -311,6 +377,16 @@ unsigned long mem_cgroup_soft_limit_reclaim(struct zone 
 *zone, int order,
   return 0;
  }
  
 +static inline bool mem_cgroup_has_dirty_limit(void)
 +{
 + return false;
 +}
 +
 +static inline void get_vm_dirty_param(struct vm_dirty_param *param)
 +{
 + get_global_vm_dirty_param(param);
 +}
 +
  #endif /* CONFIG_CGROUP_MEM_CONT */
  
  #endif /* _LINUX_MEMCONTROL_H */
 diff --git a/mm/memcontrol.c b/mm/memcontrol.c
 index b7c23ea..91770d0 100644
 --- 

[Devel] Re: [PATCH -mmotm 4/5] memcg: dirty pages accounting and limiting infrastructure

2010-03-14 Thread KAMEZAWA Hiroyuki
On Mon, 15 Mar 2010 00:26:41 +0100
Andrea Righi ari...@develer.com wrote:

 Infrastructure to account dirty pages per cgroup and add dirty limit
 interfaces in the cgroupfs:
 
  - Direct write-out: memory.dirty_ratio, memory.dirty_bytes
 
  - Background write-out: memory.dirty_background_ratio, 
 memory.dirty_background_bytes
 
 Signed-off-by: Andrea Righi ari...@develer.com

Acked-by: KAMEZAWA Hiroyuki kamezawa.hir...@jp.fujitsu.com


___
Containers mailing list
contain...@lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/containers

___
Devel mailing list
Devel@openvz.org
https://openvz.org/mailman/listinfo/devel


[Devel] Re: [PATCH -mmotm 4/5] memcg: dirty pages accounting and limiting infrastructure

2010-03-10 Thread Vivek Goyal
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
___
Containers mailing list
contain...@lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/containers

___
Devel mailing list
Devel@openvz.org
https://openvz.org/mailman/listinfo/devel