Skip to contentSkip to conversation

mm/memcg: swappiness should between 0 and 100

PATCH In review Wanpeng Li 2 participants 6 messages Jul 6, 2012

Subsystems (3)
lore
Share & tools
lore

Wanpeng Li

author
#0 lore raw

PATCH 1/1 mm/memcg: swappiness should between 0 and 100

From: Wanpeng Li <[email protected]>

---
 mm/memcontrol.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
mm/memcontrol.c +1 -1
index 5e4d1ab..69a7d45 100644
@@ -4176,7 +4176,7 @@ static int mem_cgroup_swappiness_write(struct cgroup *cgrp, struct cftype *cft,
 	struct mem_cgroup *memcg = mem_cgroup_from_cont(cgrp);
 	struct mem_cgroup *parent;
 
-	if (val > 100)
+	if (val > 100 || val < 0)
 		return -EINVAL;
 
 	if (cgrp->parent == NULL)
Signature · 7 lines
1.7.5.4

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
#1 lore raw

mm/memcontrol.c static int mem_cgroup_swappiness_write(struct cgroup *cgrp, struct cftype *cft,

Quoted 12 lines · Wanpeng Li

From: Wanpeng Li <[email protected]>

---
mm/memcontrol.c | 2 +-

1 files changed, 1 insertions(+), 1 deletions(-)
mm/memcontrol.c +0 -0
index 5e4d1ab..69a7d45 100644
@@ -4176,7 +4176,7 @@ static int mem_cgroup_swappiness_write(struct cgroup *cgrp, struct cftype *cft,

It seems that we don't have the function in mainline.

shangw@shangw:~/sandbox/linux/mm$ grep mem_cgroup_swappiness_write -r .
shangw@shangw:~/sandbox/linux/mm$ 

Thanks,
Gavin

Quoted 17 lines
mm/memcontrol.c +1 -1
 	struct mem_cgroup *memcg = mem_cgroup_from_cont(cgrp);
 	struct mem_cgroup *parent;
 
-	if (val > 100)
+	if (val > 100 || val < 0)
 		return -EINVAL;
 
 	if (cgrp->parent == NULL)
Signature · 7 lines
1.7.5.4

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#2 lore raw
Quoted 16 lines · Gavin Shan

mm/memcontrol.c static int mem_cgroup_swappiness_write(struct cgroup *cgrp, struct cftype *cft,

Quoted 12 lines · Wanpeng Li

From: Wanpeng Li <[email protected]>

---
mm/memcontrol.c | 2 +-

1 files changed, 1 insertions(+), 1 deletions(-)
mm/memcontrol.c +0 -0
index 5e4d1ab..69a7d45 100644
@@ -4176,7 +4176,7 @@ static int mem_cgroup_swappiness_write(struct cgroup *cgrp, struct cftype *cft,

It seems that we don't have the function in mainline.

Quoted 3 lines
shangw@shangw:~/sandbox/linux/mm$ grep mem_cgroup_swappiness_write -r .
shangw@shangw:~/sandbox/linux/mm$ 

Please ignore that cause my git tree has some problems and everything in linux/mm has been cleared :-)

Thanks,
Gavin

Quoted 27 lines

Thanks,
Gavin

Quoted 17 lines
mm/memcontrol.c +1 -1
 	struct mem_cgroup *memcg = mem_cgroup_from_cont(cgrp);
 	struct mem_cgroup *parent;
 
-	if (val > 100)
+	if (val > 100 || val < 0)
 		return -EINVAL;
 
 	if (cgrp->parent == NULL)
Signature · 7 lines
1.7.5.4

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected]  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected] For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

author
#3 lore raw
Quoted 17 lines · Gavin Shan
Quoted 16 lines · Gavin Shan

mm/memcontrol.c static int mem_cgroup_swappiness_write(struct cgroup *cgrp, struct cftype *cft,

Quoted 12 lines · Wanpeng Li

From: Wanpeng Li <[email protected]>

---
mm/memcontrol.c | 2 +-

1 files changed, 1 insertions(+), 1 deletions(-)
mm/memcontrol.c +0 -0
index 5e4d1ab..69a7d45 100644
@@ -4176,7 +4176,7 @@ static int mem_cgroup_swappiness_write(struct cgroup *cgrp, struct cftype *cft,

It seems that we don't have the function in mainline.

Quoted 6 lines
Quoted 3 lines
shangw@shangw:~/sandbox/linux/mm$ grep mem_cgroup_swappiness_write -r .
shangw@shangw:~/sandbox/linux/mm$ 

Please ignore that cause my git tree has some problems and everything in linux/mm has been cleared :-)

No problem. :-)

Best Regards,
Wanpeng Li

Quoted 31 lines

Thanks,
Gavin

Quoted 27 lines

Thanks,
Gavin

Quoted 17 lines
mm/memcontrol.c +1 -1
 	struct mem_cgroup *memcg = mem_cgroup_from_cont(cgrp);
 	struct mem_cgroup *parent;
 
-	if (val > 100)
+	if (val > 100 || val < 0)
 		return -EINVAL;
 
 	if (cgrp->parent == NULL)
Signature · 7 lines
1.7.5.4

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected]  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected] For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#4 lore raw
In reply to Wanpeng Li
Quoted 12 lines · Wanpeng Li

From: Wanpeng Li <[email protected]>

---
mm/memcontrol.c | 2 +-

1 files changed, 1 insertions(+), 1 deletions(-)
mm/memcontrol.c +0 -0
index 5e4d1ab..69a7d45 100644

mm/memcontrol.c static int mem_cgroup_swappiness_write(struct cgroup *cgrp, struct cftype *cft, · line 4179

Quoted 5 lines
mm/memcontrol.c +1 -1
@@ -4176,7 +4176,7 @@ static int mem_cgroup_swappiness_write(struct cgroup *cgrp, struct cftype *cft,
 	struct mem_cgroup *memcg = mem_cgroup_from_cont(cgrp);
 	struct mem_cgroup *parent;
 
-	if (val > 100)
+	if (val > 100 || val < 0)

Wanpeng, the "val" was defined as "u64". So how it could be less than 0?

static int mem_cgroup_swappiness_write(struct cgroup *cgrp, struct cftype *cft,

                                       u64 val)

Thanks,
Gavin

Quoted 12 lines
mm/memcontrol.c +0 -0
 		return -EINVAL;
 
 	if (cgrp->parent == NULL)
Signature · 7 lines
1.7.5.4

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

author
#5 lore raw
Quoted 16 lines · Gavin Shan
Quoted 15 lines · Wanpeng Li

From: Wanpeng Li <[email protected]>

---
mm/memcontrol.c | 2 +-

1 files changed, 1 insertions(+), 1 deletions(-)
mm/memcontrol.c +0 -0
index 5e4d1ab..69a7d45 100644
@@ -4176,7 +4176,7 @@ static int mem_cgroup_swappiness_write(struct cgroup *cgrp, struct cftype *cft,
 	struct mem_cgroup *memcg = mem_cgroup_from_cont(cgrp);
 	struct mem_cgroup *parent;
 
Quoted 8 lines

mm/memcontrol.c static int mem_cgroup_swappiness_write(struct cgroup *cgrp, struct cftype *cft, · line 4179

Quoted 2 lines
mm/memcontrol.c +1 -1
-	if (val > 100)
+	if (val > 100 || val < 0)

Wanpeng, the "val" was defined as "u64". So how it could be less than 0?

static int mem_cgroup_swappiness_write(struct cgroup *cgrp, struct cftype *cft,

                                      u64 val)

Oh, thank you! Just ignore this patch.

Regards,
Wanpeng Li

Quoted 15 lines

Thanks,
Gavin

Quoted 12 lines
mm/memcontrol.c +0 -0
 		return -EINVAL;
 
 	if (cgrp->parent == NULL)
Signature · 7 lines
1.7.5.4

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>