All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] memcg swap: use mem_cgroup_uncharge_swap
@ 2012-03-23 20:54 Hugh Dickins
  2012-03-24  0:29 ` Johannes Weiner
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Hugh Dickins @ 2012-03-23 20:54 UTC (permalink / raw)
  To: Andrew Morton
  Cc: KAMEZAWA Hiroyuki, Daisuke Nishimura, Johannes Weiner,
	Michal Hocko, linux-mm

That stuff __mem_cgroup_commit_charge_swapin() does with a swap entry,
it has a name and even a declaration: just use mem_cgroup_uncharge_swap().

Signed-off-by: Hugh Dickins <hughd@google.com>
---

 mm/memcontrol.c |   19 +------------------
 1 file changed, 1 insertion(+), 18 deletions(-)

--- linux.git/mm/memcontrol.c	2012-03-23 10:19:53.576051635 -0700
+++ linux/mm/memcontrol.c	2012-03-23 10:51:03.996092671 -0700
@@ -2850,24 +2850,7 @@ __mem_cgroup_commit_charge_swapin(struct
 	 */
 	if (do_swap_account && PageSwapCache(page)) {
 		swp_entry_t ent = {.val = page_private(page)};
-		struct mem_cgroup *swap_memcg;
-		unsigned short id;
-
-		id = swap_cgroup_record(ent, 0);
-		rcu_read_lock();
-		swap_memcg = mem_cgroup_lookup(id);
-		if (swap_memcg) {
-			/*
-			 * This recorded memcg can be obsolete one. So, avoid
-			 * calling css_tryget
-			 */
-			if (!mem_cgroup_is_root(swap_memcg))
-				res_counter_uncharge(&swap_memcg->memsw,
-						     PAGE_SIZE);
-			mem_cgroup_swap_statistics(swap_memcg, false);
-			mem_cgroup_put(swap_memcg);
-		}
-		rcu_read_unlock();
+		mem_cgroup_uncharge_swap(ent);
 	}
 	/*
 	 * At swapin, we may charge account against cgroup which has no tasks.

--
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: use mem_cgroup_uncharge_swap
  2012-03-23 20:54 [PATCH] memcg swap: use mem_cgroup_uncharge_swap Hugh Dickins
@ 2012-03-24  0:29 ` Johannes Weiner
  2012-03-26  1:13 ` KAMEZAWA Hiroyuki
  2012-04-05  3:19 ` [patch] memcg swap: use mem_cgroup_uncharge_swap fix David Rientjes
  2 siblings, 0 replies; 5+ messages in thread
From: Johannes Weiner @ 2012-03-24  0:29 UTC (permalink / raw)
  To: Hugh Dickins
  Cc: Andrew Morton, KAMEZAWA Hiroyuki, Daisuke Nishimura,
	Michal Hocko, linux-mm

On Fri, Mar 23, 2012 at 01:54:59PM -0700, Hugh Dickins wrote:
> That stuff __mem_cgroup_commit_charge_swapin() does with a swap entry,
> it has a name and even a declaration: just use mem_cgroup_uncharge_swap().
> 
> 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: use mem_cgroup_uncharge_swap
  2012-03-23 20:54 [PATCH] memcg swap: use mem_cgroup_uncharge_swap Hugh Dickins
  2012-03-24  0:29 ` Johannes Weiner
@ 2012-03-26  1:13 ` KAMEZAWA Hiroyuki
  2012-04-05  3:19 ` [patch] memcg swap: use mem_cgroup_uncharge_swap fix David Rientjes
  2 siblings, 0 replies; 5+ messages in thread
From: KAMEZAWA Hiroyuki @ 2012-03-26  1:13 UTC (permalink / raw)
  To: Hugh Dickins
  Cc: Andrew Morton, Daisuke Nishimura, Johannes Weiner, Michal Hocko,
	linux-mm

(2012/03/24 5:54), Hugh Dickins wrote:

> That stuff __mem_cgroup_commit_charge_swapin() does with a swap entry,
> it has a name and even a declaration: just use mem_cgroup_uncharge_swap().
> 
> Signed-off-by: Hugh Dickins <hughd@google.com>


Thank you.
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

* [patch] memcg swap: use mem_cgroup_uncharge_swap fix
  2012-03-23 20:54 [PATCH] memcg swap: use mem_cgroup_uncharge_swap Hugh Dickins
  2012-03-24  0:29 ` Johannes Weiner
  2012-03-26  1:13 ` KAMEZAWA Hiroyuki
@ 2012-04-05  3:19 ` David Rientjes
  2012-04-05 14:49   ` Michal Hocko
  2 siblings, 1 reply; 5+ messages in thread
From: David Rientjes @ 2012-04-05  3:19 UTC (permalink / raw)
  To: Hugh Dickins, Andrew Morton
  Cc: KAMEZAWA Hiroyuki, Daisuke Nishimura, Johannes Weiner,
	Michal Hocko, linux-mm

linux-next fails with this 

mm/memcontrol.c: In function '__mem_cgroup_commit_charge_swapin':
mm/memcontrol.c:2837: error: implicit declaration of function 'mem_cgroup_uncharge_swap'

if CONFIG_SWAP is disabled.  Fix it.

Signed-off-by: David Rientjes <rientjes@google.com>
---
 include/linux/swap.h |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/include/linux/swap.h b/include/linux/swap.h
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -529,6 +529,10 @@ static inline void deactivate_swap_token(struct mm_struct *mm, bool swap_token)
 {
 }
 
+static inline void mem_cgroup_uncharge_swap(swp_entry_t ent)
+{
+}
+
 static inline void disable_swap_token(struct mem_cgroup *memcg)
 {
 }

--
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: use mem_cgroup_uncharge_swap fix
  2012-04-05  3:19 ` [patch] memcg swap: use mem_cgroup_uncharge_swap fix David Rientjes
@ 2012-04-05 14:49   ` Michal Hocko
  0 siblings, 0 replies; 5+ messages in thread
From: Michal Hocko @ 2012-04-05 14:49 UTC (permalink / raw)
  To: David Rientjes
  Cc: Hugh Dickins, Andrew Morton, KAMEZAWA Hiroyuki,
	Daisuke Nishimura, Johannes Weiner, linux-mm

On Wed 04-04-12 20:19:18, David Rientjes wrote:
> linux-next fails with this 
> 
> mm/memcontrol.c: In function '__mem_cgroup_commit_charge_swapin':
> mm/memcontrol.c:2837: error: implicit declaration of function 'mem_cgroup_uncharge_swap'
> 
> if CONFIG_SWAP is disabled.  Fix it.

Although this is correct maybe it would be better to move the definition
outside the CONFIG_SWAP to prevent from duplication
What do you think about the following?
---

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-04-05 14:49 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:54 [PATCH] memcg swap: use mem_cgroup_uncharge_swap Hugh Dickins
2012-03-24  0:29 ` Johannes Weiner
2012-03-26  1:13 ` KAMEZAWA Hiroyuki
2012-04-05  3:19 ` [patch] memcg swap: use mem_cgroup_uncharge_swap fix David Rientjes
2012-04-05 14:49   ` Michal Hocko

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.