Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752240Ab3HEEJx (ORCPT ); Mon, 5 Aug 2013 00:09:53 -0400 Received: from szxga03-in.huawei.com ([119.145.14.66]:47434 "EHLO szxga03-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750945Ab3HEEJw (ORCPT ); Mon, 5 Aug 2013 00:09:52 -0400 Message-ID: <51FF2560.8020206@huawei.com> Date: Mon, 5 Aug 2013 12:09:04 +0800 From: Li Zefan User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:17.0) Gecko/20130620 Thunderbird/17.0.7 MIME-Version: 1.0 To: Tejun Heo CC: Jens Axboe , Vivek Goyal , Matt Helsley , Johannes Weiner , Michal Hocko , Balbir Singh , Aristeu Rozanski , , , Subject: Re: [PATCH cgroup/for-3.12] cgroup: make css_for_each_descendant() and friends include the origin css in the iteration References: <20130804230703.GA12029@htj.dyndns.org> In-Reply-To: <20130804230703.GA12029@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 Content-Length: 2004 Lines: 43 > Previously, all css descendant iterators didn't include the origin > (root of subtree) css in the iteration. The reasons were maintaining > consistency with css_for_each_child() and that at the time of > introduction more use cases needed skipping the origin anyway; > however, given that css_is_descendant() considers self to be a > descendant, omitting the origin css has become more confusing and > looking at the accumulated use cases rather clearly indicates that > including origin would result in simpler code overall. > > While this is a change which can easily lead to subtle bugs, cgroup > API including the iterators has recently gone through major > restructuring and no out-of-tree changes will be applicable without > adjustments making this a relatively acceptable opportunity for this > type of change. > > The conversions are mostly straight-forward. If the iteration block > had explicit origin handling before or after, it's moved inside the > iteration. If not, if (pos == origin) continue; is added. Some > conversions add extra reference get/put around origin handling by > consolidating origin handling and the rest. While the extra ref > operations aren't strictly necessary, this shouldn't cause any > noticeable difference. > > Signed-off-by: Tejun Heo > Cc: Li Zefan > Cc: Jens Axboe > Cc: Vivek Goyal > Cc: Matt Helsley > Cc: Johannes Weiner > Cc: Michal Hocko > Cc: Balbir Singh > Cc: Aristeu Rozanski I was wondering this would be better when I converted cgroup_cfts_commits() to use this iterator. Acked-by: Li Zefan -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/