Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp4118432ybg; Fri, 25 Oct 2019 13:37:06 -0700 (PDT) X-Google-Smtp-Source: APXvYqzTWX4+b2u4jqlqXs0DiB2naZhIbcmO68Pez2VDTN62U58vBSE6UkAU0+xk8RV4Ghxyl6wJ X-Received: by 2002:aa7:cfd4:: with SMTP id r20mr6104406edy.268.1572035826304; Fri, 25 Oct 2019 13:37:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572035826; cv=none; d=google.com; s=arc-20160816; b=jrb5lgeNObvNDdet8cHZTzu1ZQE6elW3Li9aJVGr1NU6iVnu/lrfrKY1krcyX3OCPL RbKHYD4iDG+o8IgosuctJHQ7zWZEtyVdG5ssdDZHPHfT0+0ViWEdkMhybqBd/TPMK65P L2f+++1c5sH0Q8U4emh62cBXzf7UxR7lbgpoFwgXKzEhJ/lj8UZJUuEBI4JdKRdzMKAI CxSLuKJos27f+ciAva2lQCIVxs10mbxA5dcLZCC/o9H6SfXCmPg9dEqlot1PCDe2nDrL VIUykiMJuqIaycer70jJjQ6T7R1DWS1fRZrLJSPzYXlBxm9AsbhGYL3mLTL4jdUY8x0o wLig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=jz6SMctia4OFi35O6t3T83rMIjXwWOeaB2AsT3K2i5Q=; b=0KtBMTvWFb8zrqR3JvsRjICgXah6J6qwwUiURyavKQOFwqUkddNpm8FkaiFiPIGERa XUGz5DfCLgM9k1WVgcF6Q7RUPDd8lLCqqi6ZxfQhXSwNbuuEJU1e0p6zOI+9VgGHQ/Nx grXICRMO/AcAYo28HALp+kvd+Aq6S6QBXQuuyDFt/MejViJgyWlwdrzNXq/6JnLqY9wJ N3/EanfGPJeZIObd9TStfQKfCOtrkgZ40/x4cI9IVOxq0whUq6ezLsviLCGHMbxrK3DI UrBesebg3QVwBX5Fq/bGHpWKfhsLHlw5kKe6wvXWjknWCszyk4mTMF/1ZkFbjhdeQza3 MAww== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id oq28si1779550ejb.358.2019.10.25.13.36.43; Fri, 25 Oct 2019 13:37:06 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2436979AbfJYOcp (ORCPT + 99 others); Fri, 25 Oct 2019 10:32:45 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:47282 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727003AbfJYOcp (ORCPT ); Fri, 25 Oct 2019 10:32:45 -0400 Received: from [213.220.153.21] (helo=wittgenstein) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1iO0de-0007qC-Bl; Fri, 25 Oct 2019 14:32:26 +0000 Date: Fri, 25 Oct 2019 16:32:25 +0200 From: Christian Brauner To: Oleg Nesterov Cc: Tejun Heo , dvyukov@google.com, Li Zefan , Johannes Weiner , akpm@linux-foundation.org, arnd@arndb.de, deepa.kernel@gmail.com, ebiederm@xmission.com, elver@google.com, guro@fb.com, linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com, cgroups@vger.kernel.org, kernel-team@fb.com Subject: Re: [PATCH cgroup/for-5.5] cgroup: remove cgroup_enable_task_cg_lists() optimization Message-ID: <20191025143224.wtwkkimqq4644iqq@wittgenstein> References: <0000000000003b1e8005956939f1@google.com> <20191021142111.GB1339@redhat.com> <20191024190351.GD3622521@devbig004.ftw2.facebook.com> <20191025125606.GI3622521@devbig004.ftw2.facebook.com> <20191025133358.pxpzxkhqc3mboi5x@wittgenstein> <20191025141325.GB6020@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20191025141325.GB6020@redhat.com> User-Agent: NeoMutt/20180716 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Oct 25, 2019 at 04:13:25PM +0200, Oleg Nesterov wrote: > On 10/25, Christian Brauner wrote: > > > > [+Dmitry] > > > > On Fri, Oct 25, 2019 at 05:56:06AM -0700, Tejun Heo wrote: > > > On Thu, Oct 24, 2019 at 12:03:51PM -0700, Tejun Heo wrote: > > > > cgroup_enable_task_cg_lists() is used to lazyily initialize task > > > > cgroup associations on the first use to reduce fork / exit overheads > > > > on systems which don't use cgroup. Unfortunately, locking around it > > > > has never been actually correct and its value is dubious given how the > > > > vast majority of systems use cgroup right away from boot. > > > > > > > > This patch removes the optimization. For now, replace the cg_list > > > > based branches with WARN_ON_ONCE()'s to be on the safe side. We can > > > > simplify the logic further in the future. > > > > > > > > Signed-off-by: Tejun Heo > > > > Reported-by: Oleg Nesterov > > > > > > Applying to cgroup/for-5.5. > > > > The code you removed was the only place where task->flags was set from > > !current. > > No, that code doesn't modify task->flags. It checks PF_EXITING under siglock > but this makes no sense and can't avoid the race with cgroup_exit(). Sorry, you are right. I misread Ah right, sorry I misremembered this from the prior thread where we discussed where ->flags is set from [1]. > > > So I think this fixes the syzbot data-race report in: > > https://lore.kernel.org/r/0000000000003b1e8005956939f1@google.com > > No. > > Almost every usage of task->flags (load or sore) can be reported as "data race". > > Say, you do > > if (task->flags & PF_KTHREAD) > > while this task does > > current->flags |= PF_FREEZER_SKIP; > schedule(). > > this is data race. Right, but I thought we agreed on WONTFIX in those scenarios? The alternative is to READ_ONCE()/WRITE_ONCE() all of these. [1]: https://lore.kernel.org/r/20191021134659.GA1339@redhat.com Anyway, accidental noise on my part. Christian