ub_dirty_limits is meant to be used for dirty pages throttling.
Currently, it is not, because the corresponding hunk was not applied for
some reason, but it must and will be backported. In this function we
need to know the current container's ram size to calculate dirty limits
(current, because ub equals get_exec_ub() - see RH6). Currently, it is
obtained from UB_PHYSPAGES as it was ported from RH6. This is wrong,
because memory limits are now managed by memcg, so we should get it
there. This patch fixes it.

Signed-off-by: Vladimir Davydov <vdavy...@parallels.com>
---
 kernel/bc/io_acct.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/kernel/bc/io_acct.c b/kernel/bc/io_acct.c
index e9a0d9bf8219..ee30fea69926 100644
--- a/kernel/bc/io_acct.c
+++ b/kernel/bc/io_acct.c
@@ -11,6 +11,7 @@
  */
 
 #include <linux/mm.h>
+#include <linux/memcontrol.h>
 #include <linux/mempool.h>
 #include <linux/proc_fs.h>
 #include <linux/virtinfo.h>
@@ -134,8 +135,8 @@ int ub_dirty_limits(unsigned long *pbackground,
        if (!dirty_ratio)
                return 0;
 
-       available_memory = ub->ub_parms[UB_PHYSPAGES].limit;
-       if (available_memory == UB_MAXVALUE || available_memory == 0)
+       available_memory = mem_cgroup_ram_pages();
+       if (available_memory == ULONG_MAX || available_memory == 0)
                return 0;
 
        *pdirty = (dirty_ratio * available_memory) / 100;
-- 
1.7.10.4

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

Reply via email to