Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp3259776pxb; Fri, 5 Nov 2021 12:28:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJylcVHvYCpyOlneddGLj+xe1okY7MNzKcfBO0EpBXtFZ6t5uIJd6Cyxs0eaWum2llTa7Rtn X-Received: by 2002:a92:8751:: with SMTP id d17mr38764012ilm.104.1636140522596; Fri, 05 Nov 2021 12:28:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1636140522; cv=none; d=google.com; s=arc-20160816; b=bI0fV+J8B/ipA2lvLIDOZy0+t6e2NySXN97vJ2nx9fmbn6rLD4NpiWDg+u9G7DcU+9 l3Rykt7W3Et0u2NfJEgD+lnSI1bcY9GUL/gF4YDezNu6q0h/LlG6aSksj9QRp6QwYZhN bEFnVJHGDwzdBtvlPuFtwfXmNbaruErQm/pW5t/22vhWPB4ZIPIMqvnaLNZFdXjKwjUw rFCuzTxcGdKLw86sMOXR6BqKvU+mtejZbe9m0u7VOTL26ELe5eOnwzJK8S8YR7mIp5fj 67pdlUEFDOnyEi4VkYm7mSUiB+KZLPU5y0f6qZ8i5RuZBEy7sw39kwo3IR7YwYYkiLL8 gjzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=+j1/xAiEIC6nTouHB02W+EU9E1MWR8L29Tegegb7m5I=; b=PyLZ97Z3zecZo7HdbJ4+pINkHjHmfiFKj6FuWBv6D7/uewITFpsQj7A5QwENI0KLI2 6D2VSpT3WLEWXM6PqY9NPvaAv6ZOQwwFqZad5VQEbO7sJd9S3A+WhfX1ZLzgCYdxcmZR 5416eBZQOKLeDJ1i8KB2pSX+oVaCb924Xa9Yfu82ypie+eDWXBi1opyFqBE20ogz65QF 2b5gQlSpkPE+qUNnWY/XWc50NDIbEKPA712nwQjMvnSy3DOzk9oxDqoSJ81kZ84Dk9gO jrNtGcrhKgtXR8ZZafWqkI9pn8KAAsoAlY+n3XdNz2wNCTpnSo3q+e1N0/xpbeWsBJ4b KOWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=T5jlVIrH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w3si6709054jad.8.2021.11.05.12.28.30; Fri, 05 Nov 2021 12:28:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=T5jlVIrH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234190AbhKERbA (ORCPT + 99 others); Fri, 5 Nov 2021 13:31:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40544 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231689AbhKERa7 (ORCPT ); Fri, 5 Nov 2021 13:30:59 -0400 Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B6101C061714 for ; Fri, 5 Nov 2021 10:28:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=+j1/xAiEIC6nTouHB02W+EU9E1MWR8L29Tegegb7m5I=; b=T5jlVIrHjUi0TxOlYlZYyLjfhn 3ORz4lrlDr0NWTo02+svZcK6hLAi7sLzsCs5bBE4lPSbCQaYTeyYeUyLU8oYNMF/oJkpbyMKKvG+S 8DbF7dkpFslhR3lsnRtur6Hs/Fl5ijBJAfgvc5Co4HcYK1wPT0aL5M3OoQ37oy2CZCtztLGoORJ/L PF5/mwfuQBd76duvwbyCQ/FQXkaTT2KdV3RC58VIPJ3bzdKCEl+TmcpoaHD/Jnhkw/n0gd93MrcO1 mlwFqQCpNKqkycPEUr/UhzpcWjewoJ42rlbFr6iVNxNET9W01hrDXROrS8hiEBKtwEVncUzNo4+2E myGxLOBQ==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1mj30O-00ENHK-9n; Fri, 05 Nov 2021 17:27:56 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 9B9453000D5; Fri, 5 Nov 2021 18:27:55 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 5F865203C0534; Fri, 5 Nov 2021 18:27:55 +0100 (CET) Date: Fri, 5 Nov 2021 18:27:55 +0100 From: Peter Zijlstra To: Mathias Krause Cc: Vincent Guittot , Michal =?iso-8859-1?Q?Koutn=FD?= , Benjamin Segall , Ingo Molnar , Juri Lelli , Dietmar Eggemann , Steven Rostedt , Mel Gorman , Daniel Bristot de Oliveira , Valentin Schneider , linux-kernel@vger.kernel.org, Odin Ugedal , Kevin Tanguy , Brad Spengler Subject: Re: [PATCH] sched/fair: Prevent dead task groups from regaining cfs_rq's Message-ID: References: <8f4ed996-e6e5-75f4-b5fa-dffb7b7da05b@grsecurity.net> <20211105162914.215420-1-minipli@grsecurity.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Nov 05, 2021 at 06:14:33PM +0100, Mathias Krause wrote: > Am 05.11.21 um 17:58 schrieb Peter Zijlstra: > > On Fri, Nov 05, 2021 at 05:29:14PM +0100, Mathias Krause wrote: > >>> Looks like it needs to be the kfree_rcu() one in this case. I'll prepare > >>> a patch. > >> > >> Testing the below patch right now. Looking good so far. Will prepare a > >> proper patch later, if we all can agree that this covers all cases. > >> > >> But the basic idea is to defer the kfree()'s to after the next RCU GP, > >> which also means we need to free the tg object itself later. Slightly > >> ugly. :/ > > > > Can't we add an rcu_head to struct task_group and simply call_rcu() the > > thing with a free function? > > There is already one and this patch makes use of it for the second RCU > GP requirement. Basically, the patch is doing what you request, no? See > the new free_fair_sched_group(). For some reason I thought you still did kfree_rcu(), I suppose reading is hard. I'll give it another go after dinner.