From: Tejun Heo Subject: Re: [PATCH 09/10] cpuset: allow to keep tasks in empty cpusets Date: Fri, 19 Apr 2013 13:58:21 -0700 Message-ID: <20130419205821.GA15543@mtj.dyndns.org> References: <517137A7.4020605@huawei.com> <517138A4.3070209@huawei.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:sender:date:from:to:cc:subject:message-id:references :mime-version:content-type:content-disposition:in-reply-to :user-agent; bh=0//zS0Ql1WB5B/ZQ/jaOMeyrGoTfDbQSCtq6TjcOq5c=; b=hZrKKHZIUeVFLX42scVoWepog7jW6xg78m5vcfXyexIE7zVFoVllB76maGBKSno4qt SsvkbO46K1jhL+ujshxBFNekg3yAtMFUcu+qVI568kKPRwtJYfiKhEbsWS0fB6KWbMpe eQUGVeFSgmegL3eFygNKGGXa/OPUu+CClbITSI6m4l3A4j6Xwn4Ag1spYiC6iPCBL0m+ ZZmbhsKKw6UC2qnzpT6GJCRPllozGxZab26OEbyJKQ7LWEHNztxBVIvHa8MFYoSP+eS7 1CsarxSZ/9An6dIMf0xsJG3646Qxpr1ZyONg9JdrDgdkQigmwDujP7T5MOlEmblDpcYs D9pw== Content-Disposition: inline In-Reply-To: <517138A4.3070209-hv44wF8Li93QT0dZR+AlfA@public.gmane.org> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: containers-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org Errors-To: containers-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org To: Li Zefan Cc: Cgroups , Containers , LKML Hello, On Fri, Apr 19, 2013 at 08:29:24PM +0800, Li Zefan wrote: > +static void update_tasks_cpumask_hier(struct cpuset *root_cs, > + bool update_root, struct ptr_heap *heap) > +{ > + struct cpuset *cp; > + struct cgroup *pos_cgrp; > + > + if (update_root) > + update_tasks_cpumask(root_cs, heap); > + > + rcu_read_lock(); > + cpuset_for_each_descendant_pre(cp, pos_cgrp, root_cs) { > + /* skip the whole subtree if @cp have some CPU */ > + if (!cpumask_empty(cp->cpus_allowed)) { > + pos_cgrp = cgroup_rightmost_descendant(pos_cgrp); > + continue; > + } > + > + update_tasks_cpumask(cp, heap); > + } > + rcu_read_unlock(); I don't think we can call update_tasks_cpumask() under rcu_read_lock(). It calls into set_cpus_allowed_ptr() which may block, so you'll probably have to punt it to a work item like how migration is being done. Another approach would be converting cgroup to use SRCU instead, which would lessen pain on other places too. The only problem there would be that srcu_read_lock() is a bit more expensive than rcu_read_lock(). I'm not sure whether that'd show up in some hot path or not. Ideas? Thanks. -- tejun