[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87lin38mkd.fsf@linux.vnet.ibm.com>
Date: Wed, 14 Mar 2012 16:40:58 +0530
From: "Aneesh Kumar K.V" <aneesh.kumar@...ux.vnet.ibm.com>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: linux-mm@...ck.org, mgorman@...e.de,
kamezawa.hiroyu@...fujitsu.com, dhillf@...il.com,
aarcange@...hat.com, mhocko@...e.cz, hannes@...xchg.org,
linux-kernel@...r.kernel.org, cgroups@...r.kernel.org
Subject: Re: [PATCH -V3 5/8] hugetlbfs: Add memcg control files for hugetlbfs
On Tue, 13 Mar 2012 14:42:33 -0700, Andrew Morton <akpm@...ux-foundation.org> wrote:
> On Tue, 13 Mar 2012 12:37:09 +0530
> "Aneesh Kumar K.V" <aneesh.kumar@...ux.vnet.ibm.com> wrote:
>
> > From: "Aneesh Kumar K.V" <aneesh.kumar@...ux.vnet.ibm.com>
> >
> > This add control files for hugetlbfs in memcg
> >
> > ...
> >
> > --- a/include/linux/hugetlb.h
> > +++ b/include/linux/hugetlb.h
> > @@ -220,6 +221,10 @@ struct hstate {
> > unsigned int nr_huge_pages_node[MAX_NUMNODES];
> > unsigned int free_huge_pages_node[MAX_NUMNODES];
> > unsigned int surplus_huge_pages_node[MAX_NUMNODES];
> > + /* cgroup control files */
> > + struct cftype cgroup_limit_file;
> > + struct cftype cgroup_usage_file;
> > + struct cftype cgroup_max_usage_file;
> > char name[HSTATE_NAME_LEN];
> > };
>
> We don't need all these in here if, for example, cgroups is disabled?
Will fix.
>
> > ...
> >
> > --- a/mm/hugetlb.c
> > +++ b/mm/hugetlb.c
> > @@ -1817,6 +1817,36 @@ static int __init hugetlb_init(void)
> > }
> > module_init(hugetlb_init);
> >
> > +#ifdef CONFIG_MEM_RES_CTLR_HUGETLB
> > +int register_hugetlb_memcg_files(struct cgroup *cgroup,
> > + struct cgroup_subsys *ss)
> > +{
> > + int ret = 0;
> > + struct hstate *h;
> > +
> > + for_each_hstate(h) {
> > + ret = cgroup_add_file(cgroup, ss, &h->cgroup_limit_file);
> > + if (ret)
> > + return ret;
> > + ret = cgroup_add_file(cgroup, ss, &h->cgroup_usage_file);
> > + if (ret)
> > + return ret;
> > + ret = cgroup_add_file(cgroup, ss, &h->cgroup_max_usage_file);
> > + if (ret)
> > + return ret;
> > +
> > + }
> > + return ret;
> > +}
> > +/* mm/memcontrol.c because mem_cgroup_read/write is not availabel outside */
>
> Comment has a spelling mistake.
Will fix
>
> > +int mem_cgroup_hugetlb_file_init(struct hstate *h, int idx);
>
>
> No, please put it in a header file. Always. Where both callers and
> the implementation see the same propotype.
>
> > +#else
> > +static int mem_cgroup_hugetlb_file_init(struct hstate *h, int idx)
> > +{
> > + return 0;
> > +}
> > +#endif
>
> So this will go into the same header file.
>
I was not sure whether i want to put mem_cgroup_hugetlb_file_init in
linux/memcontrol.h . Ideally i want to have that in mm/hugetlb.c and in
linux/hugetlb.h. That would require me to make mem_cgroup_read and
others non static and move few #defines to memcontrol.h. That would
involve larger code movement which i didn't want to do. ? What do you
suggest ? Just move mem_cgroup_hugetlb_file_init to memcontrol.h ?
-aneesh
--
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