Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp811678imw; Fri, 8 Jul 2022 12:10:43 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tt6+1zUcDoB2zfxs9xASl+UnT25RXPDVVxoVgYMMGA3NX0S5XRcsMFHDKRtLuHuI+MToBr X-Received: by 2002:a17:903:2406:b0:16a:fd0:a65e with SMTP id e6-20020a170903240600b0016a0fd0a65emr5295433plo.124.1657307442764; Fri, 08 Jul 2022 12:10:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657307442; cv=none; d=google.com; s=arc-20160816; b=mb3TeECpkkV6rEBY6x7FqcXsKrfieRF0enlot/aC4lQeMNBe4Xdq6yhLA1uFTkAROi 1b9e5haXxLaowpCb92aPp+sfTPRUzrPNvxwx/5Wo2ltC2rxi7otmuaa8xYa+oLQD71dN qAPt7O3D+TwAbObhOGVqeZMlMXVbyTfaetxgh0wIn1jqZqaABGV7HtYTN70sRgRzkBbT qkAeZnA0oN63L3Bc6a8figbIlI0NUTsnRLShLKAofKK/KfEM9+RZZYpeZSsD21bHbbEZ ojfG+hTT3TqKHoujG0f+gOnA9SFiZOE3mkBgAlkVnPxKIJu931sWkM/1W4ZDElLTulmJ 6Acg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=Yw34BoQJQrqUw2Oj5qG+JmnW+t2FC7L2vO9hGoX3l4g=; b=B3VSMKsbi2olv7zO6u4LuhKizPmx3gZ371ZbCiDFwdFr+85q1fbFd1pXA95LonApwM yY41j2hYmXUxmYYwiFoscqCFWIZONTVv1gyZsMb+Jeeq2rx6WwhXqn9xzWNfTps6OgIS sS9ZnWi48KlJnnVhNe6ETkv73UtbEOlODDrd2r2xQHWmjbP0M0FdbMMnbRZH721gqq+4 KF0klrQnlrJDaYn7jZS/AJUljnHTQG6PFyyDqzqE1Mb5EcmdGzWVfYT9H3kqRHjLEbBx lrz9UlWguAo6XA09bT9jTzQJo+8BC26Eybzb0HO9kfLan5gXXnMO/Nib7mrg57Q2yZHE axGw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 135-20020a63028d000000b0041250b7bf13si8742017pgc.212.2022.07.08.12.10.24; Fri, 08 Jul 2022 12:10:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239356AbiGHTGW (ORCPT + 99 others); Fri, 8 Jul 2022 15:06:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53250 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239283AbiGHTGV (ORCPT ); Fri, 8 Jul 2022 15:06:21 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5881E27B2D for ; Fri, 8 Jul 2022 12:06:20 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 0A389B824F7 for ; Fri, 8 Jul 2022 19:06:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8C168C341C0; Fri, 8 Jul 2022 19:06:16 +0000 (UTC) Date: Fri, 8 Jul 2022 15:06:14 -0400 From: Steven Rostedt To: Schspa Shi Cc: mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, bsegall@google.com, mgorman@suse.de, bristot@redhat.com, vschneid@redhat.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3] sched/rt: fix bad task migration for rt tasks Message-ID: <20220708150614.2cda886d@gandalf.local.home> In-Reply-To: References: <20220707165014.77127-1-schspa@gmail.com> <20220707135329.08cf74b0@gandalf.local.home> <20220708140000.6aa75a50@gandalf.local.home> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-6.7 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham 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 On Sat, 09 Jul 2022 02:19:42 +0800 Schspa Shi wrote: > Yes, it's what I did in the V1 patch. > Link: https://lore.kernel.org/all/20220623182932.58589-1-schspa@gmail.com/ > > But I think it's not the best solution for this problem. > In these scenarios, we still have a chance to make the task run faster > by retrying to retry to push the currently running task on this CPU away. > > There is more details on V2 patch's replay message. > Link: https://lore.kernel.org/all/CAMA88TrZ-o4W81Yfw9Wcs3ghoxwpeAKtFejtMTt78GNB0tKaSA@mail.gmail.com/#t The thing is, this situation can only happen if we release the rq lock in find_lock_lowest_rq(), and we should not be checking for it in the other cases. Perhaps add the check in find_lock_lowest_rq() and also in the !lowest_rq case do: task = pick_next_pushable_task(rq); if (task == next_task) { + /* + * If next task has now disabled migrating, see if we + * can push the current task. + */ + if (unlikely(is_migrate_disabled(task))) + goto retry; /* * The task hasn't migrated, and is still the next * eligible task, but we failed to find a run-queue * to push it to. Do not retry in this case, since * other CPUs will pull from us when ready. */ goto out; } -- Steve