From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753471AbdAZKRT (ORCPT ); Thu, 26 Jan 2017 05:17:19 -0500 Received: from merlin.infradead.org ([205.233.59.134]:56420 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753242AbdAZKRQ (ORCPT ); Thu, 26 Jan 2017 05:17:16 -0500 Date: Thu, 26 Jan 2017 11:17:02 +0100 From: Peter Zijlstra To: Konstantin Khlebnikov Cc: Tejun Heo , Ingo Molnar , linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: Re: [PATCH 1/2] sched/cgroup: move sched_online_group() back into css_online() Message-ID: <20170126101702.GX6515@twins.programming.kicks-ass.net> References: <148542370148.63697.501199781041713381.stgit@buzz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <148542370148.63697.501199781041713381.stgit@buzz> User-Agent: Mutt/1.5.23.1 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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? > > 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? /* * 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; > +}