Re: [PATCH] [Cleanup] memcg: export memory cgroup's swappiness v2

From: Michal Hocko
Date: Thu Jun 30 2011 - 03:33:18 EST


On Thu 30-06-11 16:10:39, KAMEZAWA Hiroyuki wrote:
> On Thu, 30 Jun 2011 08:32:32 +0200
> Michal Hocko <mhocko@xxxxxxx> wrote:
>
> > On Thu 30-06-11 12:32:29, KAMEZAWA Hiroyuki wrote:
> > [...]
> > > @@ -4288,7 +4287,7 @@ static u64 mem_cgroup_swappiness_read(struct cgroup *cgrp, struct cftype *cft)
> > > {
> > > struct mem_cgroup *memcg = mem_cgroup_from_cont(cgrp);
> > >
> > > - return get_swappiness(memcg);
> > > + return mem_cgroup_swappiness(memcg);
> > > }
> >
> > If you want to be type clean you should change this one as well. I
> > think it is worth it, though. The function is called only to return the
> > current value to userspace and mem_cgroup_swappiness_write guaranties
> > that it falls down into <0,100> interval. Additionally, cftype doesn't
> > have any read specialization for int values so you would need to use a
> > generic one. Finally if you changed read part you should change also
> > write part and add > 0 check which is a lot of code for not that good
> > reason.
>
> I don't want to make this type-clean.

Agreed.

> Should I add type casting as
> ==
> return (u64) mem_cgroup_swappiness(memcg);
> ==
> ?

I do not think it is necessary. The value is promoted to u64
automatically.

--
Michal Hocko
SUSE Labs
SUSE LINUX s.r.o.
Lihovarska 1060/12
190 00 Praha 9
Czech Republic
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/