From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753785AbdAZK1e (ORCPT ); Thu, 26 Jan 2017 05:27:34 -0500 Received: from forwardcorp1g.cmail.yandex.net ([87.250.241.190]:37589 "EHLO forwardcorp1g.cmail.yandex.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753575AbdAZK1b (ORCPT ); Thu, 26 Jan 2017 05:27:31 -0500 Authentication-Results: smtpcorp1m.mail.yandex.net; dkim=pass header.i=@yandex-team.ru Subject: Re: [PATCH 1/2] sched/cgroup: move sched_online_group() back into css_online() To: Peter Zijlstra References: <148542370148.63697.501199781041713381.stgit@buzz> <20170126101702.GX6515@twins.programming.kicks-ass.net> Cc: Tejun Heo , Ingo Molnar , linux-kernel@vger.kernel.org, stable@vger.kernel.org From: Konstantin Khlebnikov Message-ID: <3c16244d-d098-82da-0c34-d270249857f3@yandex-team.ru> Date: Thu, 26 Jan 2017 13:27:21 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 In-Reply-To: <20170126101702.GX6515@twins.programming.kicks-ass.net> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 26.01.2017 13:17, Peter Zijlstra wrote: > On Thu, Jan 26, 2017 at 12:41:41PM +0300, Konstantin Khlebnikov wrote: >> Commit 2f5177f0fd7e ("sched/cgroup: Fix/cleanup cgroup teardown/init") moved >> sched_online_group() from css_online() to css_alloc(). It exposes half-baked >> task group into global lists before initializing generic cgroup stuff. >> >> LTP testcase (third in cgroup_regression_test) written for testing >> similar race in kernels 2.6.26-2.6.28 easily triggers this oops: >> > > So nobody's run LTP against the kernel for almost a year? Yep. Nobody runs LTP =) CONFIG_RT_GROUP_SCHED must be y (which almost impossible to use IRL, I have some patches for it out of tree) Also systemd by default binds cgroups cpu and cpuacct together - this breaks testcase. > >> >> Here task group already linked into global RCU-protected list task_groups >> but pointer css->cgroup is still NULL. >> >> This patch reverts this chunk and moves online back to css_online(). > > Maybe put a comment with it that explains why this is needed? > > Something along the lines of this perhaps? > Actually online is called before complete initialization. See second patch. =) I don't know what to do with this. cgroups are messy as always. > /* > * Don't expose the cgroup until initialization of it is complete in the > * cgroup core. Otherwise things like cgroup_path() will return NULL > * pointers and the like. > */ > >> +static int cpu_cgroup_css_online(struct cgroup_subsys_state *css) >> +{ >> + struct task_group *tg = css_tg(css); >> + struct task_group *parent = css_tg(css->parent); >> + >> + if (parent) >> + sched_online_group(tg, parent); >> + return 0; >> +}