[Devel] [PATCH RH7 v2 0/2] fixes for memory cgroup id refcounting

Pavel Tikhomirov ptikhomirov at virtuozzo.com
Tue Jul 11 07:32:02 MSK 2023


Complete memcg id refcount design:

- on cgroup online get css refcount and set memcg id refctount to 1
- on cgroup offline put memcg id refcount
- on swapout:
  - if cgroup memcg id refcount is 0 (not online), use parent cgroup
  - if cgroup memcg id refcount is >0, get it
  (previously in rh7 we got css refcount instead)
- on swapin put memcg id refcount
  (previously in rh7 we put css refcount instead)
- on charge move from one to another cgroup put memcg id refctount on
"from" cgroup and get it on "to" cgroup
(previously in rh7 we put css refcount on "from" and get on "to")
- on last memcg id refctount put also put css refcount

Charge move is a bit tricky as we can move swap -> non-swap, thus we get
"to" memcg id refcount in mem_cgroup_move_charge_pte_range, and put
"from" memcg id refcount later in __mem_cgroup_clear_mc.

So, in the first patch of this series we remove leftover memcg id
refcount put on memcg free path, and in the second patch we remove
leftover "to" css refcount get in task move code for moved swap.

https://jira.vzint.dev/browse/PSBM-148818
Signed-off-by: Pavel Tikhomirov <ptikhomirov at virtuozzo.com>

Pavel Tikhomirov (2):
  mm/memcontrol: remove excess put of memory cgroup id refcount on css
    free
  mm/memcontrol: remove excess css_get on task migration with swap

 mm/memcontrol.c | 14 --------------
 1 file changed, 14 deletions(-)

-- 
2.41.0



More information about the Devel mailing list