mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-23 23:21:46 +00:00
memcg: cleanup mem_cgroup_move_parent()
mem_cgroup_move_parent() calls try_charge first and cancel_charge on failure. IMHO, charge/uncharge(especially charge) is high cost operation, so we should avoid it as far as possible. This patch tries to delay try_charge in mem_cgroup_move_parent() by re-ordering checks it does. And this patch renames mem_cgroup_move_account() to __mem_cgroup_move_account(), changes the return value of __mem_cgroup_move_account() from int to void, and adds a new wrapper(mem_cgroup_move_account()), which checks whether a @pc is valid for moving account and calls __mem_cgroup_move_account(). This patch removes the last caller of trylock_page_cgroup(), so removes its definition too. Signed-off-by: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp> Acked-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> Cc: Balbir Singh <balbir@linux.vnet.ibm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
a3032a2c15
commit
57f9fd7d25
2 changed files with 37 additions and 54 deletions
|
@ -57,6 +57,8 @@ static inline void ClearPageCgroup##uname(struct page_cgroup *pc) \
|
|||
static inline int TestClearPageCgroup##uname(struct page_cgroup *pc) \
|
||||
{ return test_and_clear_bit(PCG_##lname, &pc->flags); }
|
||||
|
||||
TESTPCGFLAG(Locked, LOCK)
|
||||
|
||||
/* Cache flag is set only once (at allocation) */
|
||||
TESTPCGFLAG(Cache, CACHE)
|
||||
CLEARPCGFLAG(Cache, CACHE)
|
||||
|
@ -86,11 +88,6 @@ static inline void lock_page_cgroup(struct page_cgroup *pc)
|
|||
bit_spin_lock(PCG_LOCK, &pc->flags);
|
||||
}
|
||||
|
||||
static inline int trylock_page_cgroup(struct page_cgroup *pc)
|
||||
{
|
||||
return bit_spin_trylock(PCG_LOCK, &pc->flags);
|
||||
}
|
||||
|
||||
static inline void unlock_page_cgroup(struct page_cgroup *pc)
|
||||
{
|
||||
bit_spin_unlock(PCG_LOCK, &pc->flags);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue