Re: [PATCH v9] Refactor part of the oom report in dump_header

From: Michal Hocko
Date: Fri Jun 22 2018 - 06:42:26 EST


On Fri 22-06-18 17:33:12, çèé wrote:
> Hi Michal
> > diff --git a/include/linux/oom.h b/include/linux/oom.h
> > index 6adac113e96d..5bed78d4bfb8 100644
> > --- a/include/linux/oom.h
> > +++ b/include/linux/oom.h
> > @@ -15,6 +15,20 @@ struct notifier_block;
> > struct mem_cgroup;
> > struct task_struct;
> >
> > +enum oom_constraint {
> > + CONSTRAINT_NONE,
> > + CONSTRAINT_CPUSET,
> > + CONSTRAINT_MEMORY_POLICY,
> > + CONSTRAINT_MEMCG,
> > +};
> > +
> > +static const char * const oom_constraint_text[] = {
> > + [CONSTRAINT_NONE] = "CONSTRAINT_NONE",
> > + [CONSTRAINT_CPUSET] = "CONSTRAINT_CPUSET",
> > + [CONSTRAINT_MEMORY_POLICY] = "CONSTRAINT_MEMORY_POLICY",
> > + [CONSTRAINT_MEMCG] = "CONSTRAINT_MEMCG",
> > +};
>
> > I've suggested that this should be a separate patch.
> I've separate this part in patch v7.
>
> [PATCH v7 1/2] Add an array of const char and enum oom_constraint in
> memcontrol.h
> On Sat 02-06-18 19:58:51, ufo19890607@xxxxxxxxx wrote:
> >> From: yuzhoujian <yuzhoujian@xxxxxxxxxxxxxxx>
> >>
> >> This patch will make some preparation for the follow-up patch: Refactor
> >> part of the oom report in dump_header. It puts enum oom_constraint in
> >> memcontrol.h and adds an array of const char for each constraint.
>
> > I do not get why you separate this specific part out.
> > oom_constraint_text is not used in the patch. It is almost always
> > preferable to have a user of newly added functionality.
>
> So do I need to separate this part ?

You misunderstood my suggestion. Let me be more specific. Please
separate the whole new oom_constraint including its _usage_.
--
Michal Hocko
SUSE Labs