From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2423CC433F5 for ; Fri, 5 Nov 2021 17:28:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 01D3D6124A for ; Fri, 5 Nov 2021 17:28:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234294AbhKERbA (ORCPT ); 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.