[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20080611121510.d91841a3.akpm@linux-foundation.org>
Date: Wed, 11 Jun 2008 12:15:10 -0700
From: Andrew Morton <akpm@...ux-foundation.org>
To: righi.andrea@...il.com
Cc: balbir@...ux.vnet.ibm.com, linux-mm@...ck.org,
skumar@...ux.vnet.ibm.com, yamamoto@...inux.co.jp,
menage@...gle.com, lizf@...fujitsu.com,
linux-kernel@...r.kernel.org, xemul@...nvz.org,
kamezawa.hiroyu@...fujitsu.com
Subject: Re: [-mm][PATCH 2/4] Setup the memrlimit controller (v5)
On Wed, 11 Jun 2008 19:10:40 +0200 (MEST)
Andrea Righi <righi.andrea@...il.com> wrote:
> 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@...il.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;
> }
>
I don't beleive the change is needed.
#define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK)
that implementation will behaved as desired when passed a 64-bit addr?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists