* [PATCH v7 1/2] Add an array of const char and enum oom_constraint in memcontrol.h
@ 2018-06-02 11:06 禹舟键
2018-06-02 11:19 ` Matthew Wilcox
0 siblings, 1 reply; 6+ messages in thread
From: 禹舟键 @ 2018-06-02 11:06 UTC (permalink / raw)
To: akpm, mhocko, rientjes, kirill.shutemov, aarcange, penguin-kernel,
guro, yang.s
Cc: linux-mm, linux-kernel, Wind Yu
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.
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
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v7 1/2] Add an array of const char and enum oom_constraint in memcontrol.h
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
2018-06-02 11:22 ` 禹舟键
0 siblings, 1 reply; 6+ messages in thread
From: Matthew Wilcox @ 2018-06-02 11:19 UTC (permalink / raw)
To: 禹舟键
Cc: akpm, mhocko, rientjes, kirill.shutemov, aarcange, penguin-kernel,
guro, yang.s, linux-mm, linux-kernel, Wind Yu
On Sat, Jun 02, 2018 at 07:06:44PM +0800, c|1e??e?(R) 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.
This patch is whitespace damaged. See the instructions for using git
send-email with gmail: https://git-scm.com/docs/git-send-email
> +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",
> +};
> +
Um, isn't this going to put the strings in every file which includes
memcontrol.h?
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v7 1/2] Add an array of const char and enum oom_constraint in memcontrol.h
2018-06-02 11:19 ` Matthew Wilcox
@ 2018-06-02 11:22 ` 禹舟键
0 siblings, 0 replies; 6+ messages in thread
From: 禹舟键 @ 2018-06-02 11:22 UTC (permalink / raw)
To: willy
Cc: akpm, mhocko, rientjes, kirill.shutemov, aarcange, penguin-kernel,
guro, yang.s, linux-mm, linux-kernel, Wind Yu
[-- Attachment #1: Type: text/plain, Size: 1036 bytes --]
Hi Mattew
Please discard this email, and I will send another email again.
Thanks
Matthew Wilcox <willy@infradead.org> 于2018年6月2日周六 下午7:19写道:
> On Sat, Jun 02, 2018 at 07:06:44PM +0800, 禹舟键 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.
>
> This patch is whitespace damaged. See the instructions for using git
> send-email with gmail: https://git-scm.com/docs/git-send-email
>
> > +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",
> > +};
> > +
>
> Um, isn't this going to put the strings in every file which includes
> memcontrol.h?
>
[-- Attachment #2: Type: text/html, Size: 1585 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v7 1/2] Add an array of const char and enum oom_constraint in memcontrol.h
@ 2018-06-02 11:58 ufo19890607
2018-06-02 11:58 ` ufo19890607
2018-06-04 6:48 ` Michal Hocko
0 siblings, 2 replies; 6+ messages in thread
From: ufo19890607 @ 2018-06-02 11:58 UTC (permalink / raw)
To: akpm, mhocko, rientjes, kirill.shutemov, aarcange, penguin-kernel,
guro, yang.s
Cc: linux-mm, linux-kernel, yuzhoujian
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.
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
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v7 1/2] Add an array of const char and enum oom_constraint in memcontrol.h
2018-06-02 11:58 ufo19890607
@ 2018-06-02 11:58 ` ufo19890607
2018-06-04 6:48 ` Michal Hocko
1 sibling, 0 replies; 6+ messages in thread
From: ufo19890607 @ 2018-06-02 11:58 UTC (permalink / raw)
To: akpm, mhocko, rientjes, kirill.shutemov, aarcange, penguin-kernel,
guro, yang.s
Cc: linux-mm, linux-kernel, yuzhoujian
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.
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
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v7 1/2] Add an array of const char and enum oom_constraint in memcontrol.h
2018-06-02 11:58 ufo19890607
2018-06-02 11:58 ` ufo19890607
@ 2018-06-04 6:48 ` Michal Hocko
1 sibling, 0 replies; 6+ messages in thread
From: Michal Hocko @ 2018-06-04 6:48 UTC (permalink / raw)
To: ufo19890607
Cc: akpm, rientjes, kirill.shutemov, aarcange, penguin-kernel, guro,
yang.s, linux-mm, linux-kernel, yuzhoujian
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
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2018-06-04 6:48 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2018-06-02 11:22 ` 禹舟键
-- strict thread matches above, loose matches on Subject: below --
2018-06-02 11:58 ufo19890607
2018-06-02 11:58 ` ufo19890607
2018-06-04 6:48 ` Michal Hocko
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).