lkml.org 
[lkml]   [2008]   [Jun]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
SubjectRe: [-mm][PATCH 2/4] Setup the memrlimit controller (v5)
Date
Balbir Singh wrote:
> +static int memrlimit_cgroup_write_strategy(char *buf, unsigned long long *tmp)
> +{
> + *tmp = memparse(buf, &buf);
> + if (*buf != '\0')
> + return -EINVAL;
> +
> + *tmp = PAGE_ALIGN(*tmp);
> + return 0;
> +}

We shouldn't use PAGE_ALIGN() here, otherwise we limit the address space
to 4GB on 32-bit architectures (that could be reasonable, because this
is a per-cgroup limit and not per-process).

Signed-off-by: Andrea Righi <righi.andrea@gmail.com>
---
mm/memrlimitcgroup.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/mm/memrlimitcgroup.c b/mm/memrlimitcgroup.c
index 9a03d7d..2d42ff3 100644
--- a/mm/memrlimitcgroup.c
+++ b/mm/memrlimitcgroup.c
@@ -29,6 +29,8 @@
#include <linux/res_counter.h>
#include <linux/memrlimitcgroup.h>

+#define PAGE_ALIGN64(addr) (((((addr)+PAGE_SIZE-1))>>PAGE_SHIFT)<<PAGE_SHIFT)
+
struct cgroup_subsys memrlimit_cgroup_subsys;

struct memrlimit_cgroup {
@@ -124,7 +126,7 @@ static int memrlimit_cgroup_write_strategy(char *buf, unsigned long long *tmp)
if (*buf != '\0')
return -EINVAL;

- *tmp = PAGE_ALIGN(*tmp);
+ *tmp = PAGE_ALIGN64(*tmp);
return 0;
}


\
 
 \ /
  Last update: 2008-06-11 19:13    [W:0.162 / U:0.220 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site