Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp1366265rdh; Mon, 25 Sep 2023 10:25:32 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHPA6JjxD5cgoaGcWL4qvCjVd755d3+6jnh1TfIacBKnAhtjCdARiG9GUhkQmjfknZHSTYf X-Received: by 2002:a05:6a00:2d16:b0:690:f6a1:ae62 with SMTP id fa22-20020a056a002d1600b00690f6a1ae62mr5585551pfb.23.1695662732509; Mon, 25 Sep 2023 10:25:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695662732; cv=none; d=google.com; s=arc-20160816; b=pnc8Q6i/IETNSGmJIkqtRRedAhasceiYkecV84BS0wjBgW3F0CUklnLqU28qPYRVEK wx92BfjnwaC7FbCBUvP5w6sbNr/QacNSICScxqih6NyZUsjGA1Nl+/sO1uV/mfG8fQ8U RRgqudwVOrueEqacIV1kq6J2S2yV37w7c8B+RRjY91LmdquEKJISaYuI2Z39aCrtTH6E nt+7+hQS92/GLsc8m7HQcIb9uOmlifvwoT44bCbqBqA4lWBGSE4arhGT1tdMT/kal2eu mzIl84yUVJzTHYkE9VUMcWHa90DBAIENBdm53SOQ+W1YLoCzEmZaS+r3fQw5VYnK5t5L jw8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:dkim-signature; bh=1MNhm+1XFFpfJQTCT/N4z0tkrQ5TUIHd0V4r09cSckw=; fh=54rU3HlnIMysMFC4IVkZeEMrZwDD5sAxZDXtoXwC7p4=; b=oaw69bTLyQtyR39f0MbpePmRw0LiytxMhyXHM2rP1y3YNHLfpW9Ylw87sfyreUJ6sv aZP6Py36Tr++kTxf6NUVHlP7gBjaP+w663+nQU1ui4z65gfzzZvb8Sdgb8faUcdFwABb SM9KLtChSge7+b9sPVl2sKoLDZhpWEbNVVeXz40sy0GJpKMr3lJYJ67XeybbWYzZAbiK RYvv5UwCVlOUZUusnnxtDN7PRRUkYmefSfWifv+aCiM9cdFgpcovgm1WKAkihcGkSejW iQVrLkEGQLnnv6PsrFB46zmPBNXtSlgYBAy59A9+arr9ksFSIujI6KodXrTFa2lxtdWP E0zA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=H6R+RRQ4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id g7-20020a636b07000000b005637962e15esi10165994pgc.603.2023.09.25.10.25.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Sep 2023 10:25:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=H6R+RRQ4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 94AEB80CBDCA; Mon, 25 Sep 2023 05:22:55 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229450AbjIYMW6 (ORCPT + 99 others); Mon, 25 Sep 2023 08:22:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51772 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229556AbjIYMW6 (ORCPT ); Mon, 25 Sep 2023 08:22:58 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 226D8FE for ; Mon, 25 Sep 2023 05:22:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1695644521; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=1MNhm+1XFFpfJQTCT/N4z0tkrQ5TUIHd0V4r09cSckw=; b=H6R+RRQ41w56WGAPBOaIOc052rKtRFr8FWdocc08AHblW0FeDzN+y3KXP+DKKSSjK7rUFr OBCckzMrwQyTzPuRKM9x4HST/bPYjb2LBKKohDckihH3nmm0BlIq1x2Q5rMNSSumjXhtQX NhNsO+R+/KocThsIhCTmjBO1K/ZawHA= Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-671-6sKqz4EhNEqVrHjYZ0S70w-1; Mon, 25 Sep 2023 08:22:00 -0400 X-MC-Unique: 6sKqz4EhNEqVrHjYZ0S70w-1 Received: by mail-wr1-f71.google.com with SMTP id ffacd0b85a97d-31f79595669so3805241f8f.0 for ; Mon, 25 Sep 2023 05:21:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695644518; x=1696249318; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=1MNhm+1XFFpfJQTCT/N4z0tkrQ5TUIHd0V4r09cSckw=; b=OPfxaspQEu7RIIrz+hsBYsxTC+oMnxUjeAJX+MzB3jFQ5Bf50135R2HHHMCgRuRPO9 r7uK1nCviroQC/eP9qA6J759YuSWq0w3quLN40GnWZEj1aWrqVQSnSxA7oLm8ELwe+cQ 4FS3gWaTGyi/lcDWaN/090fvxBbszizTFrGV5vWpqM9xObCK9k0x8xu+IGPq6KHQPCbb s38xxS4zk9ciA8wY09cyVuBYi1SiQaz98hkaWHxS1gH+eT+pdjf8aeKNmcbh7TpKTSKO 9bING/MZ4L6qC0ZL/DRq3pNcw8fO6QcDOIHnJRjZbwg2Sq2fVQ4laa7yfbBRBm+omHAC gQ7Q== X-Gm-Message-State: AOJu0Yz7NppMsRBFrOpcXt/5+6CFDmKzonLZylhcD882rOcuFGLA/C2M X7p4uvtjGQ++a/A1nBSLmTP6GYr40QsNp74ScXrwTaX0bCJPwKz9iFqaEfOqF4GR+g05MkVtwWJ Ewi3tqOONFyuzalvladyQwmjpJ6YNIxDn X-Received: by 2002:adf:e3ce:0:b0:317:dadc:4a63 with SMTP id k14-20020adfe3ce000000b00317dadc4a63mr6997874wrm.8.1695644518710; Mon, 25 Sep 2023 05:21:58 -0700 (PDT) X-Received: by 2002:adf:e3ce:0:b0:317:dadc:4a63 with SMTP id k14-20020adfe3ce000000b00317dadc4a63mr6997860wrm.8.1695644518330; Mon, 25 Sep 2023 05:21:58 -0700 (PDT) Received: from vschneid.remote.csb ([80.214.159.242]) by smtp.gmail.com with ESMTPSA id bw10-20020a0560001f8a00b0032326908972sm3230747wrb.17.2023.09.25.05.21.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Sep 2023 05:21:57 -0700 (PDT) From: Valentin Schneider To: Peter Zijlstra , linux-kernel@vger.kernel.org Cc: linux-tip-commits@vger.kernel.org, Sebastian Andrzej Siewior , Ingo Molnar , x86@kernel.org Subject: Re: [tip: sched/core] sched/rt: Make rt_rq->pushable_tasks updates drive rto_mask In-Reply-To: <20230925101127.GB31921@noisy.programming.kicks-ass.net> References: <20230811112044.3302588-1-vschneid@redhat.com> <169563211069.27769.17070510461354463740.tip-bot2@tip-bot2> <20230925101127.GB31921@noisy.programming.kicks-ass.net> Date: Mon, 25 Sep 2023 14:21:56 +0200 Message-ID: MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Mon, 25 Sep 2023 05:22:55 -0700 (PDT) On 25/09/23 12:11, Peter Zijlstra wrote: > On Mon, Sep 25, 2023 at 08:55:10AM -0000, tip-bot2 for Valentin Schneider wrote: >> The following commit has been merged into the sched/core branch of tip: >> >> Commit-ID: 612f769edd06a6e42f7cd72425488e68ddaeef0a >> Gitweb: https://git.kernel.org/tip/612f769edd06a6e42f7cd72425488e68ddaeef0a >> Author: Valentin Schneider >> AuthorDate: Fri, 11 Aug 2023 12:20:44 +01:00 >> Committer: Ingo Molnar >> CommitterDate: Mon, 25 Sep 2023 10:25:29 +02:00 >> >> sched/rt: Make rt_rq->pushable_tasks updates drive rto_mask >> >> Sebastian noted that the rto_push_work IRQ work can be queued for a CPU >> that has an empty pushable_tasks list, which means nothing useful will be >> done in the IPI other than queue the work for the next CPU on the rto_mask. >> >> rto_push_irq_work_func() only operates on tasks in the pushable_tasks list, >> but the conditions for that irq_work to be queued (and for a CPU to be >> added to the rto_mask) rely on rq_rt->nr_migratory instead. >> >> nr_migratory is increased whenever an RT task entity is enqueued and it has >> nr_cpus_allowed > 1. Unlike the pushable_tasks list, nr_migratory includes a >> rt_rq's current task. This means a rt_rq can have a migratible current, N >> non-migratible queued tasks, and be flagged as overloaded / have its CPU >> set in the rto_mask, despite having an empty pushable_tasks list. >> >> Make an rt_rq's overload logic be driven by {enqueue,dequeue}_pushable_task(). >> Since rt_rq->{rt_nr_migratory,rt_nr_total} become unused, remove them. >> >> Note that the case where the current task is pushed away to make way for a >> migration-disabled task remains unchanged: the migration-disabled task has >> to be in the pushable_tasks list in the first place, which means it has >> nr_cpus_allowed > 1. >> >> Reported-by: Sebastian Andrzej Siewior >> Signed-off-by: Valentin Schneider >> Signed-off-by: Ingo Molnar >> Tested-by: Sebastian Andrzej Siewior >> Link: https://lore.kernel.org/r/20230811112044.3302588-1-vschneid@redhat.com >> --- >> kernel/sched/debug.c | 3 +-- >> kernel/sched/rt.c | 70 ++++++------------------------------------- >> kernel/sched/sched.h | 2 +- >> 3 files changed, 10 insertions(+), 65 deletions(-) >> > >> @@ -358,53 +357,6 @@ static inline void rt_clear_overload(struct rq *rq) >> cpumask_clear_cpu(rq->cpu, rq->rd->rto_mask); >> } >> >> -static void update_rt_migration(struct rt_rq *rt_rq) >> -{ >> - if (rt_rq->rt_nr_migratory && rt_rq->rt_nr_total > 1) { >> - if (!rt_rq->overloaded) { >> - rt_set_overload(rq_of_rt_rq(rt_rq)); >> - rt_rq->overloaded = 1; >> - } >> - } else if (rt_rq->overloaded) { >> - rt_clear_overload(rq_of_rt_rq(rt_rq)); >> - rt_rq->overloaded = 0; >> - } >> -} >> - >> -static void inc_rt_migration(struct sched_rt_entity *rt_se, struct rt_rq *rt_rq) >> -{ >> - struct task_struct *p; >> - >> - if (!rt_entity_is_task(rt_se)) >> - return; >> - >> - p = rt_task_of(rt_se); >> - rt_rq = &rq_of_rt_rq(rt_rq)->rt; >> - >> - rt_rq->rt_nr_total++; >> - if (p->nr_cpus_allowed > 1) >> - rt_rq->rt_nr_migratory++; >> - >> - update_rt_migration(rt_rq); >> -} >> - >> -static void dec_rt_migration(struct sched_rt_entity *rt_se, struct rt_rq *rt_rq) >> -{ >> - struct task_struct *p; >> - >> - if (!rt_entity_is_task(rt_se)) >> - return; >> - >> - p = rt_task_of(rt_se); >> - rt_rq = &rq_of_rt_rq(rt_rq)->rt; >> - >> - rt_rq->rt_nr_total--; >> - if (p->nr_cpus_allowed > 1) >> - rt_rq->rt_nr_migratory--; >> - >> - update_rt_migration(rt_rq); >> -} > > sched/deadline.c has something very similar, does that need updating > too? Hm I think so yes: - push_dl_task() is an obvious noop if the pushable tree is empty - pull_dl_task() can be kicked if !rq->dl.overloaded, which similarly to rt is driven by nr_migratory but could be boiled down to having pushable tasks (due to the nr_cpus_allowed > 1 constraint). Lemme poke at it.