Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp2955009pxb; Fri, 5 Nov 2021 07:27:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy0QT55FIupzecWVOk5vyot7r70vDYf+hwFvvD14cU54lzSWH05sTd4KLjX5mwAOaB5WPZg X-Received: by 2002:a05:6638:329e:: with SMTP id f30mr9112823jav.63.1636122439200; Fri, 05 Nov 2021 07:27:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1636122439; cv=none; d=google.com; s=arc-20160816; b=zCbmWvKURw5h+Jx+3kY+TQRoPPAzHABnJf3tUOwwMPcx5eVWe/G/1JNYMFNrlLZefx 5VYulmuN8tKKuv/qGjM8hTIKo4Lh2v88S9uDD9WIHxG4GQUd3Sj6p5ismTkBZgNT8dmH AN3RPX+p6E4FKfWmdJywSzv/CJ4F4vBr2OTsEhMg7BiEZRhn0YiHXBxstm06IRp9kznd nQERy4R4Hj+Foz/Un0sY13Ho969R9onWvl6Hv1fE9Xx9Md1ZRT/eSGsC4o1X++9UOO9A qDkpXSB0ITqldH8VfkLqI1zO43mZ9Od3S/pWYkWOE60l8AQtG6jMQj3bdrH1ZhkczZKU Mj1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=Q/iZosAqOCPRrV2DIseKYh152abP8wsS0XjzUed2AtU=; b=jL9Gb3jQxhlhYQU6EgVnMavw2DKA20GdDfEYtqKClNvOYjiZduUR/SYjqD1aFx1zVC B2SBnuOMRCBGMiKsVrStav4JEOsuz/b4qCCaDOrdfwlmXhyfqApQPONMpgL07hqNl79x TrQu4NDjivwWxq3TApX4pFl9vpV9pSDQeznw1D/AM19Q9XJj5dvjjw7+kH59298SgXZk DTq1WiDPtZYQqGckiXCVJBOD00MlbjXcxES627MCEvBBj+2WP7iUphVeayoAH0OoWqpw Z6Y3Is9L0pcRh2MxXyZ32nHRsyMKYufEzwbVUrtDlNVdAKjPxrD1JG8Sa440qO8TLD2M vplw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hRG00Os+; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q13si15978930ilv.125.2021.11.05.07.27.03; Fri, 05 Nov 2021 07:27:19 -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=@linaro.org header.s=google header.b=hRG00Os+; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233130AbhKEO2l (ORCPT + 99 others); Fri, 5 Nov 2021 10:28:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54538 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233112AbhKEO2k (ORCPT ); Fri, 5 Nov 2021 10:28:40 -0400 Received: from mail-yb1-xb35.google.com (mail-yb1-xb35.google.com [IPv6:2607:f8b0:4864:20::b35]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 968C6C061714 for ; Fri, 5 Nov 2021 07:26:00 -0700 (PDT) Received: by mail-yb1-xb35.google.com with SMTP id y3so23249199ybf.2 for ; Fri, 05 Nov 2021 07:26:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Q/iZosAqOCPRrV2DIseKYh152abP8wsS0XjzUed2AtU=; b=hRG00Os+0h8SA08WLYoUXrgjEiZsH0Qlmhw7AWdASKh4J7CPOUOKhUiKRC3G+wjlh0 s7xdn8oOuj+AQ66Rg293BmjBFBcwIk56iScsYKogk/UuLyhLhrZaRsesXmo6kXewxcFx Vfj4Zzlif9Co4wnrobrHGUQFO2XfPtltEpJgpJ4EZU5cqOFy0/fPv+I3LNRXwKYjLtIt dYqaJ/B/89m0+dLopuM4Rz1Nuq3LZSE6ZDuK3aUQF4a7Gx+kuNVDdY9v1dGSPOd/Ykmy wnX3B9V1zzrZvRPXzqhb1IqXBjfzx7bt+5beuWO/qXzAcyYIJ6Pjd4imgL3mjctvOx0d Phcw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Q/iZosAqOCPRrV2DIseKYh152abP8wsS0XjzUed2AtU=; b=6Eeybcvwotzu7j4eEHIEMd+/G0tGU7Sr2ojOB2L/UQ5rteliqRH78ruxR10b4Lg6dS DgT+No5GapgaSJVBdQmC6Dq94ZRtX1jEjs3aiYLXXIXlf38ixKuOmJ/PJe3MI3v04GjC L12I0gDzFNyZQCog7JHUTjR76tBELnOH6R7lf/XqoIJY83KiJZo4AYcuiy7TbA1vzdk9 aWAP+05bFJ4MqFDL0r+pN0tKo0Xigv7nRcT5F57V4fJb00clSsrOmxjE0fZEkPWXCdK9 55DCvi0OYTHge0eDtfcw7bGx1N0l3/YWSuNna0V0ZuOJA+vomygXdi84Go3pOoRsXDmy zECA== X-Gm-Message-State: AOAM533myxytEzk5T2lbN0EQNMR83gB266M4+vROJHki2uocODMjfR4z Da70FTI1/1WpZGLP/2ckThzLrEbKVbDjbrkphugN9A== X-Received: by 2002:a25:d707:: with SMTP id o7mr29474179ybg.546.1636122359835; Fri, 05 Nov 2021 07:25:59 -0700 (PDT) MIME-Version: 1.0 References: <20211103190613.3595047-1-minipli@grsecurity.net> In-Reply-To: From: Vincent Guittot Date: Fri, 5 Nov 2021 15:25:46 +0100 Message-ID: Subject: Re: [PATCH] sched/fair: Prevent dead task groups from regaining cfs_rq's To: Mathias Krause Cc: Benjamin Segall , Ingo Molnar , Peter Zijlstra , Juri Lelli , =?UTF-8?Q?Michal_Koutn=C3=BD?= , Dietmar Eggemann , Steven Rostedt , Mel Gorman , Daniel Bristot de Oliveira , Valentin Schneider , linux-kernel@vger.kernel.org, Odin Ugedal , Kevin Tanguy , Brad Spengler Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 4 Nov 2021 at 18:37, Mathias Krause wrote: > > Am 04.11.21 um 17:49 schrieb Vincent Guittot: > > [snip] > > > > Ok so we must have 2 GPs: > > > > list_del_rcu(&tg->siblings); > > GP to wait for the end of ongoing walk_tg_tree_from : synchronize_rcu > > in your patch > > list_del_leaf_cfs_rq(tg->cfs_rq[cpu]); if on_list > > remove_entity_load_avg(tg->se[cpu]); > > GP to wait for the end of ongoing for_each_leaf_cfs_rq_safe (print_cfs_stats) > > kfree everything > > Basically yes, but with my patch we already have these two, as there's > at least one RCU GP between after sched_offline_group() finishes and > sched_free_group() / cpu_cgroup_css_free() starts. > > So we either use my patch as-is or move unregister_fair_sched_group() to > free_fair_sched_group() and use kfree_rcu() instead of kfree(). Both > approaches have pros and cons. > > Pro for my version is the early unlinking of cfs_rq's for dead task > groups, so no surprises later on. Con is the explicit synchronize_rcu(). which blocks the caller and could be problematic It seems that LKP has reported such issue: 20211104145128.GC6499@xsang-OptiPlex-9020 > > Pro for the kfree_rcu() approach is the lack of the explicit > synchronize_rcu() call, so no explicit blocking operation. Con is that > we have cfs_rq's re-added to dead task groups which feels wrong and need > to find a suitable member to overlap with the rcu_head in each involved > data type. > > Which one do you prefer? > > Thanks, > Mathias