On 01/29/2013 05:46 PM, Lord Glauber Costa of Sealand wrote: > Hi, > > On 01/28/2013 02:54 PM, Jeff Liu wrote: >> As we don't account the swap stat number for the root_mem_cgroup anymore, >> here we can just return an invalid CSS ID if there is no non-root memcg >> is alive. Also, introduce memsw_accounting_users to track the number of >> active non-root memcgs. >> >> Signed-off-by: Jie Liu <jeff.liu@xxxxxxxxxx> >> CC: Glauber Costa <glommer@xxxxxxxxxxxxx> >> CC: Michal Hocko <mhocko@xxxxxxx> >> CC: Kamezawa Hiroyuki <kamezawa.hiroyu@xxxxxxxxxxxxxx> >> CC: Johannes Weiner <hannes@xxxxxxxxxxx> >> CC: Mel Gorman <mgorman@xxxxxxx> >> CC: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> >> CC: Sha Zhengju <handai.szj@xxxxxxxxxx> >> >> --- >> mm/page_cgroup.c | 16 +++++++++++++++- >> 1 file changed, 15 insertions(+), 1 deletion(-) >> >> diff --git a/mm/page_cgroup.c b/mm/page_cgroup.c >> index c945254..189fbf5 100644 >> --- a/mm/page_cgroup.c >> +++ b/mm/page_cgroup.c >> @@ -336,6 +336,8 @@ struct swap_cgroup { >> }; >> #define SC_PER_PAGE (PAGE_SIZE/sizeof(struct swap_cgroup)) >> >> +static atomic_t memsw_accounting_users = ATOMIC_INIT(0); >> + > > I am not seeing this being incremented or decremented. I can only guess > that it comes in later patches. However, they are clearly used as a > global reference counter. > > This is precisely one of the use cases static branches solve very > neatly. Did you consider using them? Yep, I'll try to replace it with the static branches if there are no objections from the others. :) Thanks, -Jeff > > True, they will help a lot more when we are touching hot paths, and swap > is hardly a hot path. > > However, since one of the main complaints about memcg has been that we > inflict "death by a thousand cuts", maybe it wouldn't hurt everything > else being the same. > > Michal and others, do you have any feelings here? > -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@xxxxxxxxx. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@xxxxxxxxx"> email@xxxxxxxxx </a>