Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp2392456pxb; Mon, 20 Sep 2021 21:11:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxTigy1oe+pI4Ray+qd9Fd8fNObGETVp5zRy4xrh1Je8pQLdtbbPq2t/5HaWyxMjfcP1BU8 X-Received: by 2002:a17:907:785a:: with SMTP id lb26mr33322754ejc.77.1632197461930; Mon, 20 Sep 2021 21:11:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632197461; cv=none; d=google.com; s=arc-20160816; b=A7FHXoWIVv13itOPLoQ4GFRS6vZHcAtrLOPToyRPodbs3ANzRMG0ZQixrURrC6PqBf 32mL6cYjvEz/y35WKerGaPKpc+50El3VI5UmX0i8BDuHvr8fWAaDRiF1RyTEHwhcBRvf MxZFWhQ0Avw0FxOemNsWipXi/VSEkymazkexJNFTHSps4qc4MseqEV3RuKA4GVpDGyvk ZSDhNmLera6bpID77o8SUnt9SJWoZ7JVO5x2+4KJEB69IEpmyonQniTMvRqzM/sRKk78 O7q5PGDSAa4Njug+4CvIYXdmhAMvN9u4rQVDp7Sm8JnqFXXKqw63XPi9RTM5ttLjauhY 0xDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=7tqFjTUIXiBvPf6FAx8yLkqgiBHfgu/uf4F9JFl7j8g=; b=E0UFxM9CkJejS2t3Rg1hRQTd1n+h+us74tqEwXDAb4ccSczhlUZfZ+29X+I9J8UjbR nLEvzzPrkCDRxUIdapm7vVjhpV+/Vo5e4u/XL66i5xikXyOCh79zAJfBucLfpEbOSS2s ErLfaNd7MVhpjGxxGdi3ZjdhA8JkxEvRPuX3saFNIC9XwHQqbCBAiGl5MlzHFgmAIKRT LgeM1NMGA/5l3CYK5rwrkjWrXMl+zM/tv22TSol6s5QzqV4ahGlYt3v+k+7h9jQl7i2+ o7ZyW4hjuGbi8Lr/E7BfVMP7COL4pk70IM9HVRIZrIPGEGhyn33k6kwKUSHcfCMjFqmR jW3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@uged.al header.s=google header.b=erwejbOY; 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 j22si22998071ejt.173.2021.09.20.21.10.39; Mon, 20 Sep 2021 21:11:01 -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=@uged.al header.s=google header.b=erwejbOY; 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 S1352726AbhIUCyq (ORCPT + 99 others); Mon, 20 Sep 2021 22:54:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41936 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239642AbhIUCaD (ORCPT ); Mon, 20 Sep 2021 22:30:03 -0400 Received: from mail-qv1-xf31.google.com (mail-qv1-xf31.google.com [IPv6:2607:f8b0:4864:20::f31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DD104C0470B5 for ; Mon, 20 Sep 2021 13:06:20 -0700 (PDT) Received: by mail-qv1-xf31.google.com with SMTP id cf2so12035834qvb.10 for ; Mon, 20 Sep 2021 13:06:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=uged.al; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=7tqFjTUIXiBvPf6FAx8yLkqgiBHfgu/uf4F9JFl7j8g=; b=erwejbOYNIXzuXsHHdUD+xyNQzWUMv6q3K0hBcDZmgJNMYVGr4khmR319qaa/yfXoe XnARs8/pHWG44eW6MVowTnznWJLp2hO6K2nZPAvDOSJCNMNMDAOapAwEzL/fjsrKw/gS DlJEeMGumo9WCA55YabFsSo+2oOeHXpGMs5flRl21evsrEQ6quI40H6Y9LGV0NGjOPUm UDOdaAZ4TfASdTf/iOK129tDeEm9R7GSTUaWgpOzyNMh7b+075/H0ox0AyAex+IOKC6e t2qPhutziXkW7qhzFqJXgFwh9EjGTTO2t7FdErK8peZivOQodoJ/4s4TU+naQJfxsOxY Ovtg== 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:content-transfer-encoding; bh=7tqFjTUIXiBvPf6FAx8yLkqgiBHfgu/uf4F9JFl7j8g=; b=afh3UHYSrGFS/lF5CaeJ1DCVMLX++yvn+1KPrmlONSShKTyyMkQng9RNiPU3bSZoKl nwCUH6YHkMD1zeGfuZr7AYTBxzYylY18vqZULPwYx9ry8VcI221IXIRAP0zxD2igGncd 1JML3wE9HhLHu2u8MDw1tRspmJIeGKv4o8yOM/zG9rmZNUlWWf9i3yjviGpdxA43oiQs mU6hkvjLoIawUCGulAwPwrpKpJ5IZGWEmecsAkZHfk+5l+pWWaMlmBeGg0SUpSxo261k LJuFG6DHc7wJyuJ2rLS3qMZMqX8cQESEhje7Q6zoMaPcyK2PRCZKpoMj4IO3WIcIzpqg UEdA== X-Gm-Message-State: AOAM531/dBjMLLMswIGrCAJFfKjCpMI7KBcjXRALdWnxyTYu+OsEq4Jg JItLoRhm3XV3fFxHKgeX8aNMH4OACNxlC0ooJi2uLA== X-Received: by 2002:a05:6214:1492:: with SMTP id bn18mr24329662qvb.44.1632168379939; Mon, 20 Sep 2021 13:06:19 -0700 (PDT) MIME-Version: 1.0 References: <20210917153037.11176-1-mkoutny@suse.com> In-Reply-To: <20210917153037.11176-1-mkoutny@suse.com> From: Odin Ugedal Date: Mon, 20 Sep 2021 21:06:09 +0100 Message-ID: Subject: Re: [PATCH v3] sched/fair: Add ancestors of unthrottled undecayed cfs_rq To: =?UTF-8?Q?Michal_Koutn=C3=BD?= Cc: open list , Vincent Guittot , Phil Auld , Ingo Molnar , Peter Zijlstra , Juri Lelli , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira , Odin Ugedal , Rik van Riel , Giovanni Gherdovich Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org fre. 17. sep. 2021 kl. 16:32 skrev Michal Koutn=C3=BD : > > Since commit a7b359fc6a37 ("sched/fair: Correctly insert cfs_rq's to > list on unthrottle") we add cfs_rqs with no runnable tasks but not fully > decayed into the load (leaf) list. We may ignore adding some ancestors > and therefore breaking tmp_alone_branch invariant. This broke LTP test > cfs_bandwidth01 and it was partially fixed in commit fdaba61ef8a2 > ("sched/fair: Ensure that the CFS parent is added after unthrottling"). > > I noticed the named test still fails even with the fix (but with low > probability, 1 in ~1000 executions of the test). The reason is when > bailing out of unthrottle_cfs_rq early, we may miss adding ancestors of > the unthrottled cfs_rq, thus, not joining tmp_alone_branch properly. > > Fix this by adding ancestors if we notice the unthrottled cfs_rq was > added to the load list. > > Fixes: a7b359fc6a37 ("sched/fair: Correctly insert cfs_rq's to list on un= throttle") > Signed-off-by: Michal Koutn=C3=BD Thanks for catching this! Reviewed-by: Odin Ugedal > Changes since v2 [1]: > - jump to completion for loop, don't duplicate it > - singled out of the series (to handle a fix separately from the rest) > > [1] https://lore.kernel.org/r/20210819175034.4577-2-mkoutny@suse.com/ > > kernel/sched/fair.c | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) > > diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c > index ff69f245b939..f6a05d9b5443 100644 > --- a/kernel/sched/fair.c > +++ b/kernel/sched/fair.c > @@ -4936,8 +4936,12 @@ void unthrottle_cfs_rq(struct cfs_rq *cfs_rq) > /* update hierarchical throttle state */ > walk_tg_tree_from(cfs_rq->tg, tg_nop, tg_unthrottle_up, (void *)r= q); > > - if (!cfs_rq->load.weight) > + /* Nothing to run but something to decay (on_list)? Complete the = branch */ > + if (!cfs_rq->load.weight) { > + if (cfs_rq->on_list) > + goto unthrottle_throttle; > return; > + } > > task_delta =3D cfs_rq->h_nr_running; > idle_task_delta =3D cfs_rq->idle_h_nr_running; > -- > 2.32.0 >