From: Michal Hocko <mhocko@kernel.org>
To: ufo19890607@gmail.com
Cc: akpm@linux-foundation.org, rientjes@google.com,
kirill.shutemov@linux.intel.com, aarcange@redhat.com,
penguin-kernel@I-love.SAKURA.ne.jp, guro@fb.com,
yang.s@alibaba-inc.com, linux-mm@kvack.org,
linux-kernel@vger.kernel.org,
yuzhoujian <yuzhoujian@didichuxing.com>
Subject: Re: [PATCH v7 1/2] Add an array of const char and enum oom_constraint in memcontrol.h
Date: Mon, 4 Jun 2018 08:48:07 +0200 [thread overview]
Message-ID: <20180604064807.GD19202@dhcp22.suse.cz> (raw)
In-Reply-To: <1527940734-35161-1-git-send-email-ufo19890607@gmail.com>
On Sat 02-06-18 19:58:51, ufo19890607@gmail.com wrote:
> From: yuzhoujian <yuzhoujian@didichuxing.com>
>
> 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.
>
> Signed-off-by: yuzhoujian <yuzhoujian@didichuxing.com>
> ---
> include/linux/memcontrol.h | 14 ++++++++++++++
> mm/oom_kill.c | 7 -------
> 2 files changed, 14 insertions(+), 7 deletions(-)
>
> diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
> index d99b71bc2c66..57311b6c4d67 100644
> --- a/include/linux/memcontrol.h
> +++ b/include/linux/memcontrol.h
> @@ -62,6 +62,20 @@ struct mem_cgroup_reclaim_cookie {
> unsigned int generation;
> };
>
> +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",
> +};
> +
> #ifdef CONFIG_MEMCG
>
> #define MEM_CGROUP_ID_SHIFT 16
> diff --git a/mm/oom_kill.c b/mm/oom_kill.c
> index 8ba6cb88cf58..c806cd656af6 100644
> --- a/mm/oom_kill.c
> +++ b/mm/oom_kill.c
> @@ -237,13 +237,6 @@ unsigned long oom_badness(struct task_struct *p, struct mem_cgroup *memcg,
> return points > 0 ? points : 1;
> }
>
> -enum oom_constraint {
> - CONSTRAINT_NONE,
> - CONSTRAINT_CPUSET,
> - CONSTRAINT_MEMORY_POLICY,
> - CONSTRAINT_MEMCG,
> -};
> -
> /*
> * Determine the type of allocation constraint.
> */
> --
> 2.14.1
--
Michal Hocko
SUSE Labs
next prev parent reply other threads:[~2018-06-04 6:48 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-02 11:58 [PATCH v7 1/2] Add an array of const char and enum oom_constraint in memcontrol.h ufo19890607
2018-06-02 11:58 ` [PATCH v7 2/2] Refactor part of the oom report in dump_header ufo19890607
2018-06-03 12:49 ` Mike Rapoport
2018-06-04 1:58 ` 禹舟键
2018-06-04 2:41 ` 禹舟键
2018-06-04 4:58 ` Mike Rapoport
2018-06-04 6:25 ` 禹舟键
2018-06-08 9:53 ` 禹舟键
2018-06-10 5:12 ` Mike Rapoport
2018-06-11 7:07 ` Michal Hocko
2018-06-03 14:45 ` Tetsuo Handa
2018-06-04 6:52 ` Michal Hocko
2018-06-04 8:18 ` 禹舟键
2018-06-04 8:57 ` 禹舟键
2018-06-04 9:52 ` Michal Hocko
2018-06-04 12:13 ` 禹舟键
2018-06-04 12:17 ` Michal Hocko
2018-06-02 11:58 ` [PATCH v7 1/2] Add an array of const char and enum oom_constraint in memcontrol.h ufo19890607
2018-06-02 11:58 ` [PATCH v7 2/2] Refactor part of the oom report in dump_header ufo19890607
2018-06-04 6:48 ` Michal Hocko [this message]
-- strict thread matches above, loose matches on Subject: below --
2018-06-02 11:06 [PATCH v7 1/2] Add an array of const char and enum oom_constraint in memcontrol.h 禹舟键
2018-06-02 11:19 ` Matthew Wilcox
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180604064807.GD19202@dhcp22.suse.cz \
--to=mhocko@kernel.org \
--cc=aarcange@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=guro@fb.com \
--cc=kirill.shutemov@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=penguin-kernel@I-love.SAKURA.ne.jp \
--cc=rientjes@google.com \
--cc=ufo19890607@gmail.com \
--cc=yang.s@alibaba-inc.com \
--cc=yuzhoujian@didichuxing.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).