From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754008AbcIVH67 (ORCPT ); Thu, 22 Sep 2016 03:58:59 -0400 Received: from mailout4.samsung.com ([203.254.224.34]:35293 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752791AbcIVH66 (ORCPT ); Thu, 22 Sep 2016 03:58:58 -0400 X-AuditID: cbfee68d-f790c6d000004a75-29-57e38f3ea895 From: Jeehong Kim Subject: Re: [PATCH V2] sched/fair: Fix that tasks are not constrained by cfs_b->quota on hotplug core, when hotplug core is offline and then online. To: Ben Segall Cc: mingo@redhat.com, linux-kernel@vger.kernel.org, ezjjilong@gmail.com, Peter Zijlstra Message-id: <57E38F55.9020601@samsung.com> Date: Thu, 22 Sep 2016 16:59:17 +0900 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-transfer-encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrLLMWRmVeSWpSXmKPExsVy+t8zLV27/sfhBk9/ilpMf9nIYtH9po/d 4vKuOWwWlw4sYLI43nuAyYHVY+esu+weCzaVemxeoeXxft9VNo/Pm+QCWKO4bFJSczLLUov0 7RK4Mq4t+8ZesFuuYsK+y0wNjA8luhg5OSQETCQ23P3KBGGLSVy4t56ti5GLQ0hgJaPEud8X WWGKWt81M0IkljJK7Dw+kwnCuc8o0Xj7DzNIFZuAhsTd5nssIAlhgemMEhePrWEBSYgIKEus nrcQyObgYBYokLi4TwnE5BXQkli0qRKkgkVAVeLb3htg1aICERITJzSALeYVEJT4MfkeVKe6 xJQpuSBhZgF5ic1r3jKDbJIQWMUu0T9jHyvEHAGJb5MPgdVLCMhKbDrADHG/pMTBFTdYJjCK zEIydRbC1FlIpi5gZF7FKJpakFxQnJReZKhXnJhbXJqXrpecn7uJERIr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Oe6xKhWVegjhjl62UhNFaN+Oia9ec3t1QjVvJ/dbca7pprmz4pe9STI5v tqikSnPyZmlLrhJNmZWz+8/d3e0PMzL+7rfdMzfI1DGF98KaJ1cOtjiJWdYosRRnJBpqMRcV JwIAv9/SY90CAAA= DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org >Peter Zijlstra writes: > >> You forgot to Cc Ben, who gave you feedback on v1, which is rather poor >> style. Also, I don't see how kernel-janitors is relevant to this patch. >> This is very much not a janitorial thing. >> >> (also, why send it twice?) >> >> On Tue, Aug 30, 2016 at 10:12:40PM +0900, Jeehong Kim wrote: >>> In case that CONFIG_HOTPLUG_CPU and CONFIG_CFS_BANDWIDTH is turned on >>> and tasks in bandwidth controlled task group run on hotplug core, >>> the tasks are not controlled by cfs_b->quota when hotplug core is offline >>> and then online. The remaining tasks in task group consume all of >>> cfs_b->quota on other cores. >>> >>> The cause of this problem is described as below: >>> >>> 1. When hotplug core is offline while tasks in task group run >>> on hotplug core, unregister_fair_sched_group() deletes >>> leaf_cfs_rq_list of tg->cfs_rq[cpu] from &rq_of(cfs_rq)->leaf_cfs_rq_list. >>> >>> 2. Then, when hotplug core is online, update_runtime_enabled() >>Peter Zijlstra writes: > >> You forgot to Cc Ben, who gave you feedback on v1, which is rather poor >> style. Also, I don't see how kernel-janitors is relevant to this patch. >> This is very much not a janitorial thing. >> >> (also, why send it twice?) >> >> On Tue, Aug 30, 2016 at 10:12:40PM +0900, Jeehong Kim wrote: >>> In case that CONFIG_HOTPLUG_CPU and CONFIG_CFS_BANDWIDTH is turned on >>> and tasks in bandwidth controlled task group run on hotplug core, >>> the tasks are not controlled by cfs_b->quota when hotplug core is offline >>> and then online. The remaining tasks in task group consume all of >>> cfs_b->quota on other cores. >>> >>> The cause of this problem is described as below: >>> >>> 1. When hotplug core is offline while tasks in task group run >>> on hotplug core, unregister_fair_sched_group() deletes >>> leaf_cfs_rq_list of tg->cfs_rq[cpu] from &rq_of(cfs_rq)->leaf_cfs_rq_list. >>> >>> 2. Then, when hotplug core is online, update_runtime_enabled() >>> registers cfs_b->quota on cfs_rq->runtime_enabled of all leaf cfs_rq >>> on runqueue. However, because this is before enqueue_entity() adds >>> &cfs_rq->leaf_cfs_rq_list on &rq_of(cfs_rq)->leaf_cfs_rq_list, >>> cfs->quota is not register on cfs_rq->runtime_enabled. >>> >>> To resolve this problem, this patch makes update_runtime_enabled() >>> registers cfs_b->quota by using walk_tg_tree_from(). >> >> >>> +static int __maybe_unused __update_runtime_enabled(struct task_group *tg, void *data) >>> { >>> + struct rq *rq = data; >>> + struct cfs_rq *cfs_rq = tg->cfs_rq[cpu_of(rq)]; >>> + struct cfs_bandwidth *cfs_b = &cfs_rq->tg->cfs_bandwidth; >>> >>> + raw_spin_lock(&cfs_b->lock); >>> + raw_spin_unlock(&cfs_b->lock); >>> >>> + return 0; >>> +} >>> + >>> +static void __maybe_unused update_runtime_enabled(struct rq *rq) >>> +{ >>> + struct cfs_rq *cfs_rq = &rq->cfs; >>> + >>> + /* register cfs_b->quota on the whole tg tree */ >>> + rcu_read_lock(); >>> + walk_tg_tree_from(cfs_rq->tg, __update_runtime_enabled, tg_nop, (void *)rq); >>> + rcu_read_unlock(); >>> } >> >> Looks ok, performance on hotplug doesn't really matter. Ben, you happy >> with this? > > I'm not 100% sure about the exact timings and mechanics of hotplug, but > cfs-bandwidth wise this is ok. We may still have runtime_remaining = 1, > or we may have < 0 and yet be unthrottled, but either case is ok, even > if hotplug allows tasks to have migrated here already (I'm not sure, > looking at the code). > > Now that I check again you can just loop over the list of tgs rather > than the hierarchical walk_tg_tree_from, but there's certainly no harm > in it. Ben, Is there additional revision which I have to do? If so, could you let me know about that? Regards, Jeehong Kim