Thread (16 messages) 16 messages, 4 authors, 2011-07-06

Re: [PATCH] [Cleanup] memcg: export memory cgroup's swappiness v2

From: Michal Hocko <hidden>
Date: 2011-06-30 07:33:16
Also in: lkml

On Thu 30-06-11 16:10:39, KAMEZAWA Hiroyuki wrote:
On Thu, 30 Jun 2011 08:32:32 +0200
Michal Hocko [off-list ref] wrote:
quoted
On Thu 30-06-11 12:32:29, KAMEZAWA Hiroyuki wrote:
[...]
quoted
@@ -4288,7 +4287,7 @@ static u64 mem_cgroup_swappiness_read(struct cgroup *cgrp, struct cftype *cft)
 {
 	struct mem_cgroup *memcg = mem_cgroup_from_cont(cgrp);
 
-	return get_swappiness(memcg);
+	return mem_cgroup_swappiness(memcg);
 }
If you want to be type clean you should change this one as well. I
think it is worth it, though. The function is called only to return the
current value to userspace and mem_cgroup_swappiness_write guaranties
that it falls down into <0,100> interval. Additionally, cftype doesn't
have any read specialization for int values so you would need to use a
generic one. Finally if you changed read part you should change also
write part and add > 0 check which is a lot of code for not that good
reason.
I don't want to make this type-clean. 
Agreed.
Should I add type casting as
==
 return (u64) mem_cgroup_swappiness(memcg);
==
?
I do not think it is necessary. The value is promoted to u64
automatically.

-- 
Michal Hocko
SUSE Labs
SUSE LINUX s.r.o.
Lihovarska 1060/12
190 00 Praha 9    
Czech Republic

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help