Re: [PATCH 07/10] memcg: add dirty limits to mem_cgroup

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Greg Thelen
Date: Monday, October 11, 2010 - 5:24 pm

KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> writes:


mem_cgroup_from_task() calls task_subsys_state() calls
task_subsys_state_check().  task_subsys_state_check() will be happy if
rcu_read_lock is held.

I don't think that this will fail lockdep, because rcu_read_lock_held()
is true when calling mem_cgroup_from_task() within
try_get_mem_cgroup_from_mm()..


I do not understand how making mem_cgroup_from_task() a macro will
change its behavior wrt. to lockdep assertion checking.  I assume that
as a macro mem_cgroup_from_task() would still call task_subsys_state(),
which requires either:
a) rcu read lock held
b) task->alloc_lock held
c) cgroup lock held



It seems like a shame to need a lock to determine if current is in the
root cgroup.  Especially given that as soon as
mem_cgroup_has_dirty_limit() returns, the task could be moved
in-to/out-of the root cgroup thereby invaliding the answer.  So the
answer is just a sample that may be wrong.  But I think you are correct.
We will need the rcu read lock in mem_cgroup_has_dirty_limit().


What are the cases where current->mm->owner->cgroups !=
current->cgroups?

I was hoping to avoid having add even more logic into
mem_cgroup_has_dirty_limit() to handle the case where current->mm is
NULL.

Presumably the newly proposed vm_dirty_param(),
mem_cgroup_has_dirty_limit(), and mem_cgroup_page_stat() routines all
need to use the same logic.  I assume they should all be consistently
using current->mm->owner or current.

--
Greg
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 00/10] memcg: per cgroup dirty page accounting, Greg Thelen, (Sun Oct 3, 11:57 pm)
[PATCH 07/10] memcg: add dirty limits to mem_cgroup, Greg Thelen, (Sun Oct 3, 11:58 pm)
Re: [PATCH 01/10] memcg: add page_cgroup flags for dirty p ..., KAMEZAWA Hiroyuki, (Mon Oct 4, 11:20 pm)
Re: [PATCH 02/10] memcg: document cgroup dirty memory inte ..., KAMEZAWA Hiroyuki, (Mon Oct 4, 11:48 pm)
Re: [PATCH 03/10] memcg: create extensible page stat updat ..., KAMEZAWA Hiroyuki, (Mon Oct 4, 11:51 pm)
Re: [PATCH 04/10] memcg: disable local interrupts in lock_ ..., KAMEZAWA Hiroyuki, (Mon Oct 4, 11:54 pm)
Re: [PATCH 06/10] memcg: add kernel calls for memcg dirty ..., KAMEZAWA Hiroyuki, (Mon Oct 4, 11:55 pm)
Re: [PATCH 07/10] memcg: add dirty limits to mem_cgroup, KAMEZAWA Hiroyuki, (Tue Oct 5, 12:07 am)
Re: [PATCH 08/10] memcg: add cgroupfs interface to memcg d ..., KAMEZAWA Hiroyuki, (Tue Oct 5, 12:13 am)
Re: [PATCH 09/10] writeback: make determine_dirtyable_memo ..., KAMEZAWA Hiroyuki, (Tue Oct 5, 12:15 am)
Re: [PATCH 05/10] memcg: add dirty page accounting infrast ..., KAMEZAWA Hiroyuki, (Tue Oct 5, 12:22 am)
Re: [PATCH 10/10] memcg: check memcg dirty limits in page ..., KAMEZAWA Hiroyuki, (Tue Oct 5, 12:29 am)
Re: [PATCH 08/10] memcg: add cgroupfs interface to memcg d ..., KAMEZAWA Hiroyuki, (Tue Oct 5, 12:31 am)
Re: [PATCH 07/10] memcg: add dirty limits to mem_cgroup, KAMEZAWA Hiroyuki, (Wed Oct 6, 5:13 pm)
Re: [PATCH 07/10] memcg: add dirty limits to mem_cgroup, KAMEZAWA Hiroyuki, (Wed Oct 6, 5:48 pm)
[PATCH] memcg: reduce lock time at move charge (Was Re: [P ..., KAMEZAWA Hiroyuki, (Wed Oct 6, 11:21 pm)
[PATCH] memcg: lock-free clear page writeback (Was Re: [P ..., KAMEZAWA Hiroyuki, (Wed Oct 6, 11:24 pm)
Re: [PATCH] memcg: reduce lock time at move charge (Was Re ..., Daisuke Nishimura, (Thu Oct 7, 12:28 am)
Re: [PATCH] memcg: reduce lock time at move charge (Was Re ..., KAMEZAWA Hiroyuki, (Thu Oct 7, 12:42 am)
Re: [PATCH] memcg: lock-free clear page writeback (Was Re ..., KAMEZAWA Hiroyuki, (Thu Oct 7, 2:05 am)
Re: [PATCH v2] memcg: reduce lock time at move charge (Was ..., KAMEZAWA Hiroyuki, (Thu Oct 7, 10:12 pm)
Re: [PATCH 07/10] memcg: add dirty limits to mem_cgroup, Greg Thelen, (Mon Oct 11, 5:24 pm)
Re: [PATCH 07/10] memcg: add dirty limits to mem_cgroup, KAMEZAWA Hiroyuki, (Mon Oct 11, 5:55 pm)
Re: [PATCH v2] memcg: reduce lock time at move charge (Was ..., KAMEZAWA Hiroyuki, (Mon Oct 11, 8:42 pm)
Re: [PATCH v2] memcg: reduce lock time at move charge (Was ..., Daisuke Nishimura, (Mon Oct 11, 8:56 pm)
Re: [PATCH v2] memcg: reduce lock time at move charge (Was ..., KAMEZAWA Hiroyuki, (Mon Oct 11, 10:01 pm)
[PATCH v4] memcg: reduce lock time at move charge, KAMEZAWA Hiroyuki, (Mon Oct 11, 10:48 pm)
Re: [PATCH v4] memcg: reduce lock time at move charge, Daisuke Nishimura, (Mon Oct 11, 11:23 pm)
Re: [PATCH 07/10] memcg: add dirty limits to mem_cgroup, Greg Thelen, (Tue Oct 12, 12:32 am)
Re: [PATCH 07/10] memcg: add dirty limits to mem_cgroup, KAMEZAWA Hiroyuki, (Tue Oct 12, 1:38 am)
Re: [PATCH 00/10] memcg: per cgroup dirty page accounting, KAMEZAWA Hiroyuki, (Sun Oct 17, 10:56 pm)