From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751913Ab2KIJNX (ORCPT ); Fri, 9 Nov 2012 04:13:23 -0500 Received: from szxga01-in.huawei.com ([119.145.14.64]:16366 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751133Ab2KIJNH (ORCPT ); Fri, 9 Nov 2012 04:13:07 -0500 Message-ID: <509CC91D.4050207@huawei.com> Date: Fri, 9 Nov 2012 17:13:01 +0800 From: Li Zefan User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:16.0) Gecko/20121010 Thunderbird/16.0.1 MIME-Version: 1.0 To: Tejun Heo CC: , , , , , , Subject: Re: [PATCH 3/9 v2] cgroup: implement generic child / descendant walk macros References: <1351931915-1701-1-git-send-email-tj@kernel.org> <1351931915-1701-4-git-send-email-tj@kernel.org> <20121108175946.GA9672@htj.dyndns.org> In-Reply-To: <20121108175946.GA9672@htj.dyndns.org> Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.135.68.215] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2012/11/9 1:59, Tejun Heo wrote: > Currently, cgroup doesn't provide any generic helper for walking a > given cgroup's children or descendants. This patch adds the following > three macros. > > * cgroup_for_each_child() - walk immediate children of a cgroup. > > * cgroup_for_each_descendant_pre() - visit all descendants of a cgroup > in pre-order tree traversal. > > * cgroup_for_each_descendant_post() - visit all descendants of a > cgroup in post-order tree traversal. > > All three only require the user to hold RCU read lock during > traversal. Verifying that each iterated cgroup is online is the > responsibility of the user. When used with proper synchronization, > cgroup_for_each_descendant_pre() can be used to propagate state > updates to descendants in reliable way. See comments for details. > > v2: s/config/state/ in commit message and comments per Michal. More > documentation on synchronization rules. > > Signed-off-by: Tejun Heo > Reviewed-by: KAMEZAWA Hiroyuki > Reviewed-by: Michal Hocko I don't see anything wrong with the comment on cgroup_next_descendant_pre(). Acked-by: Li Zefan