* [PATCH 1/2] memcg: fold mem_cgroup_stolen
@ 2014-05-07 8:27 Qiang Huang
[not found] ` <5369EE5E.50202-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
0 siblings, 1 reply; 2+ messages in thread
From: Qiang Huang @ 2014-05-07 8:27 UTC (permalink / raw)
To: Michal Hocko, Johannes Weiner, bsingharora-Re5JQEeQqe8AvxtiuMwx3w,
kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A
Cc: Cgroups, linux-rt-users, Li Zefan, Andrew Morton
It is only used in __mem_cgroup_begin_update_page_stat(), the
name is confusing and 2 routines for one thing also confuse people,
so fold this function seems more clear.
Signed-off-by: Qiang Huang <h.huangqiang-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
---
mm/memcontrol.c | 25 +++++++------------------
1 file changed, 7 insertions(+), 18 deletions(-)
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 4f97662..5804d71 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -1568,23 +1568,12 @@ static void mem_cgroup_end_move(struct mem_cgroup *memcg)
}
/*
- * 2 routines for checking "mem" is under move_account() or not.
+ * A routine for checking "mem" is under move_account() or not.
*
- * mem_cgroup_stolen() - checking whether a cgroup is mc.from or not. This
- * is used for avoiding races in accounting. If true,
- * pc->mem_cgroup may be overwritten.
- *
- * mem_cgroup_under_move() - checking a cgroup is mc.from or mc.to or
- * under hierarchy of moving cgroups. This is for
- * waiting at hith-memory prressure caused by "move".
+ * Checking a cgroup is mc.from or mc.to or under hierarchy of
+ * moving cgroups. This is for waiting at hith-memory pressure
+ * caused by "move".
*/
-
-static bool mem_cgroup_stolen(struct mem_cgroup *memcg)
-{
- VM_BUG_ON(!rcu_read_lock_held());
- return atomic_read(&memcg->moving_account) > 0;
-}
-
static bool mem_cgroup_under_move(struct mem_cgroup *memcg)
{
struct mem_cgroup *from;
@@ -1627,7 +1616,6 @@ static bool mem_cgroup_wait_acct_move(struct mem_cgroup *memcg)
* Take this lock when
* - a code tries to modify page's memcg while it's USED.
* - a code tries to modify page state accounting in a memcg.
- * see mem_cgroup_stolen(), too.
*/
static void move_lock_mem_cgroup(struct mem_cgroup *memcg,
unsigned long *flags)
@@ -2301,9 +2289,10 @@ again:
* If this memory cgroup is not under account moving, we don't
* need to take move_lock_mem_cgroup(). Because we already hold
* rcu_read_lock(), any calls to move_account will be delayed until
- * rcu_read_unlock() if mem_cgroup_stolen() == true.
+ * rcu_read_unlock().
*/
- if (!mem_cgroup_stolen(memcg))
+ VM_BUG_ON(!rcu_read_lock_held());
+ if (atomic_read(&memcg->moving_account) <= 0)
return;
move_lock_mem_cgroup(memcg, flags);
--
1.8.3
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-05-07 9:17 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-07 8:27 [PATCH 1/2] memcg: fold mem_cgroup_stolen Qiang Huang
[not found] ` <5369EE5E.50202-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2014-05-07 9:17 ` Michal Hocko
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox