* [PATCH] memcg swap: mem_cgroup_move_swap_account never needs fixup
@ 2012-03-23 20:51 Hugh Dickins
2012-03-23 21:09 ` Andrew Morton
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Hugh Dickins @ 2012-03-23 20:51 UTC (permalink / raw)
To: Andrew Morton
Cc: KAMEZAWA Hiroyuki, Daisuke Nishimura, Johannes Weiner,
Michal Hocko, linux-mm
The need_fixup arg to mem_cgroup_move_swap_account() is always false,
so just remove it.
Signed-off-by: Hugh Dickins <hughd@google.com>
---
I believe it's now agreed that an 81-column line is better left unsplit.
mm/memcontrol.c | 19 +++----------------
1 file changed, 3 insertions(+), 16 deletions(-)
--- linux.git/mm/memcontrol.c 2012-03-23 10:19:53.576051635 -0700
+++ linux/mm/memcontrol.c 2012-03-23 10:50:31.196094204 -0700
@@ -3160,7 +3160,6 @@ void mem_cgroup_uncharge_swap(swp_entry_
* @entry: swap entry to be moved
* @from: mem_cgroup which the entry is moved from
* @to: mem_cgroup which the entry is moved to
- * @need_fixup: whether we should fixup res_counters and refcounts.
*
* It succeeds only when the swap_cgroup's record for this entry is the same
* as the mem_cgroup's id of @from.
@@ -3171,7 +3170,7 @@ void mem_cgroup_uncharge_swap(swp_entry_
* both res and memsw, and called css_get().
*/
static int mem_cgroup_move_swap_account(swp_entry_t entry,
- struct mem_cgroup *from, struct mem_cgroup *to, bool need_fixup)
+ struct mem_cgroup *from, struct mem_cgroup *to)
{
unsigned short old_id, new_id;
@@ -3190,24 +3189,13 @@ static int mem_cgroup_move_swap_account(
* swap-in, the refcount of @to might be decreased to 0.
*/
mem_cgroup_get(to);
- if (need_fixup) {
- if (!mem_cgroup_is_root(from))
- res_counter_uncharge(&from->memsw, PAGE_SIZE);
- mem_cgroup_put(from);
- /*
- * we charged both to->res and to->memsw, so we should
- * uncharge to->res.
- */
- if (!mem_cgroup_is_root(to))
- res_counter_uncharge(&to->res, PAGE_SIZE);
- }
return 0;
}
return -EINVAL;
}
#else
static inline int mem_cgroup_move_swap_account(swp_entry_t entry,
- struct mem_cgroup *from, struct mem_cgroup *to, bool need_fixup)
+ struct mem_cgroup *from, struct mem_cgroup *to)
{
return -EINVAL;
}
@@ -5529,8 +5517,7 @@ put: /* get_mctgt_type() gets the page
break;
case MC_TARGET_SWAP:
ent = target.ent;
- if (!mem_cgroup_move_swap_account(ent,
- mc.from, mc.to, false)) {
+ if (!mem_cgroup_move_swap_account(ent, mc.from, mc.to)) {
mc.precharge--;
/* we fixup refcnts and charges later. */
mc.moved_swap++;
--
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>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] memcg swap: mem_cgroup_move_swap_account never needs fixup
2012-03-23 20:51 [PATCH] memcg swap: mem_cgroup_move_swap_account never needs fixup Hugh Dickins
@ 2012-03-23 21:09 ` Andrew Morton
2012-03-24 5:53 ` Cong Wang
2012-03-24 0:26 ` Johannes Weiner
2012-03-26 1:12 ` KAMEZAWA Hiroyuki
2 siblings, 1 reply; 5+ messages in thread
From: Andrew Morton @ 2012-03-23 21:09 UTC (permalink / raw)
To: Hugh Dickins
Cc: KAMEZAWA Hiroyuki, Daisuke Nishimura, Johannes Weiner,
Michal Hocko, linux-mm
On Fri, 23 Mar 2012 13:51:26 -0700 (PDT)
Hugh Dickins <hughd@google.com> wrote:
> I believe it's now agreed that an 81-column line is better left unsplit.
There's always a way ;)
> + if (!mem_cgroup_move_swap_account(ent, mc.from, mc.to)) {
The code sometimes uses "mem_cgroup" and sometimes "memcg". I don't
think the _, r, o, u and p add any value...
--
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>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] memcg swap: mem_cgroup_move_swap_account never needs fixup
2012-03-23 20:51 [PATCH] memcg swap: mem_cgroup_move_swap_account never needs fixup Hugh Dickins
2012-03-23 21:09 ` Andrew Morton
@ 2012-03-24 0:26 ` Johannes Weiner
2012-03-26 1:12 ` KAMEZAWA Hiroyuki
2 siblings, 0 replies; 5+ messages in thread
From: Johannes Weiner @ 2012-03-24 0:26 UTC (permalink / raw)
To: Hugh Dickins
Cc: Andrew Morton, KAMEZAWA Hiroyuki, Daisuke Nishimura,
Michal Hocko, linux-mm
On Fri, Mar 23, 2012 at 01:51:26PM -0700, Hugh Dickins wrote:
> The need_fixup arg to mem_cgroup_move_swap_account() is always false,
> so just remove it.
>
> Signed-off-by: Hugh Dickins <hughd@google.com>
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
--
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>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] memcg swap: mem_cgroup_move_swap_account never needs fixup
2012-03-23 21:09 ` Andrew Morton
@ 2012-03-24 5:53 ` Cong Wang
0 siblings, 0 replies; 5+ messages in thread
From: Cong Wang @ 2012-03-24 5:53 UTC (permalink / raw)
To: linux-mm
On Fri, 23 Mar 2012 at 21:09 GMT, Andrew Morton <akpm@linux-foundation.org> wrote:
> On Fri, 23 Mar 2012 13:51:26 -0700 (PDT)
> Hugh Dickins <hughd@google.com> wrote:
>
>> I believe it's now agreed that an 81-column line is better left unsplit.
>
> There's always a way ;)
>
>> + if (!mem_cgroup_move_swap_account(ent, mc.from, mc.to)) {
>
> The code sometimes uses "mem_cgroup" and sometimes "memcg". I don't
> think the _, r, o, u and p add any value...
>
It seems that all global function/structs use "mem_cgroup", while local
variables use "memcg", don't know if this is a rule...
--
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>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] memcg swap: mem_cgroup_move_swap_account never needs fixup
2012-03-23 20:51 [PATCH] memcg swap: mem_cgroup_move_swap_account never needs fixup Hugh Dickins
2012-03-23 21:09 ` Andrew Morton
2012-03-24 0:26 ` Johannes Weiner
@ 2012-03-26 1:12 ` KAMEZAWA Hiroyuki
2 siblings, 0 replies; 5+ messages in thread
From: KAMEZAWA Hiroyuki @ 2012-03-26 1:12 UTC (permalink / raw)
To: Hugh Dickins
Cc: Andrew Morton, Daisuke Nishimura, Johannes Weiner, Michal Hocko,
linux-mm
(2012/03/24 5:51), Hugh Dickins wrote:
> The need_fixup arg to mem_cgroup_move_swap_account() is always false,
> so just remove it.
>
> Signed-off-by: Hugh Dickins <hughd@google.com>
Acked-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
--
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>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-03-26 1:13 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-23 20:51 [PATCH] memcg swap: mem_cgroup_move_swap_account never needs fixup Hugh Dickins
2012-03-23 21:09 ` Andrew Morton
2012-03-24 5:53 ` Cong Wang
2012-03-24 0:26 ` Johannes Weiner
2012-03-26 1:12 ` KAMEZAWA Hiroyuki
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox