Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp230141pxb; Tue, 12 Apr 2022 00:00:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwJDug5QJQZ8487Le3YP2CGE1vlinsSNDygIMDabLRs0G1wxQSp7AFsQG79/7U+k5mB0YJv X-Received: by 2002:a17:907:7fa0:b0:6e8:aea6:4e34 with SMTP id qk32-20020a1709077fa000b006e8aea64e34mr2384695ejc.309.1649746807465; Tue, 12 Apr 2022 00:00:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649746807; cv=none; d=google.com; s=arc-20160816; b=JOCy+Ld+nx0n/5R6qjP2YWIqWOZ88Wn5pSwefd5z20IkYbojvIciK3bPpDUOBUzUWh vLNXq/ucurusdZtRxRZ2BqiTLFVgg4EPz0NSnon/RliCpyzPYWeMdW0Q6LcnlBH1BNFL sNzGQgTbUS78v1RYMtzFGT8HA22Z4SEldua+1I4b1oTHAf7lpeJFQ/Gd+8sHot2E9c9g nJ5ypexrbU4qxGFkPe+HxBTqeOLK4nf1BzVp75rZ6Oui8joGnY/caclU7XcpiUJxqStD bkLHZ3qKYA5aLdl899AHMepJ4LWdJ2FrRlA0BoC+xLzBtsTVusTFZDOYWs7AvzYPUW+b ZEkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=y+y84jbEz77Dz1btMWIwPxsLV1SwRPVDuN01Ah8KBIU=; b=dF4qaNp4jIvrfB6E9g0O/BBKHslqp/nJiL2HzODaVv6L/G9in7wx20eH3amEHwLfQj DGFMtwrDccZVWuuopMEWWvqu9w/1mZdcCyShgB4zE8WZfIutK7Pcq4prdGRt5klTZqPF bAIZNPli7orLNdzdcDvoo80CGxLnnicvt5XVvAtpITsHUaTSlOF83qpP7Z0A0Y9+HTNq FN3/sit2BVvU+7QwOWaLBqnOjl4MPzNXR5aK8G53UC1IW4GDwVprBRpAERwAXZ94Gu+g IA/BmuhDJEazmokKieWiOs5ZPYb6Xbh2vpUq1/jsVz9HV42l2j1c/mO8mV+VXZK8Izr8 0bZQ== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o15-20020a170906974f00b006e8035bb2f1si10305615ejy.548.2022.04.11.23.59.42; Tue, 12 Apr 2022 00:00:07 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233410AbiDKXhN (ORCPT + 99 others); Mon, 11 Apr 2022 19:37:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44916 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229812AbiDKXhL (ORCPT ); Mon, 11 Apr 2022 19:37:11 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 3782B1276B for ; Mon, 11 Apr 2022 16:34:56 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 86B511570; Mon, 11 Apr 2022 16:34:55 -0700 (PDT) Received: from airbuntu (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 0209E3F73B; Mon, 11 Apr 2022 16:34:52 -0700 (PDT) Date: Tue, 12 Apr 2022 00:34:47 +0100 From: Qais Yousef To: David Laight Cc: Vincent Guittot , Dietmar Eggemann , "mingo@redhat.com" , "peterz@infradead.org" , "juri.lelli@redhat.com" , "rostedt@goodmis.org" , "bsegall@google.com" , "mgorman@suse.de" , "linux-kernel@vger.kernel.org" , "parth@linux.ibm.com" , "chris.hyser@oracle.com" , "pkondeti@codeaurora.org" , "Valentin.Schneider@arm.com" , "patrick.bellasi@matbug.net" , "pjt@google.com" , "pavel@ucw.cz" , "tj@kernel.org" , "qperret@google.com" , "tim.c.chen@linux.intel.com" , Wei Wang Subject: Re: Scheduling tasks on idle cpu Message-ID: <20220411233447.rcencjivkhyltyxm@airbuntu> References: <030aacb0c1304e43ab917924dcf4f138@AcuMS.aculab.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <030aacb0c1304e43ab917924dcf4f138@AcuMS.aculab.com> X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,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 04/11/22 08:26, David Laight wrote: > From: Qais Yousef > > Sent: 09 April 2022 18:09 > ... > > RT scheduler will push/pull tasks to ensure the task will get to run ASAP if > > there's another cpu at lower priority is available > > Does that actually happen? For RT tasks, yes. They should get distributed. > I've seen the following: > 34533 [017]: sys_futex(uaddr: 1049104, op: 85, val: 1, utime: 1, uaddr2: 1049100, val3: 4000001) > 34533 [017]: sched_migrate_task: pid=34512 prio=120 orig_cpu=14 dest_cpu=17 > 34533 [017]: sched_wakeup: pid=34512 prio=120 success=1 target_cpu=017 prio=120 is a CFS task, no? > and pid 34512 doesn't get scheduled until pid 34533 finally sleeps. > This is in spite of there being 5 idle cpu. > cpu 14 is busy running a RT thread, but migrating to cpu 17 seems wrong. > > This is on a RHEL7 kernel, I've not replicated it on anything recent. > But I've very much like a RT thread to be able to schedule a non-RT > thread to run on an idle cpu. Oh, you want CFS to avoid CPUs that are running RT tasks. We had a proposal in the past, but it wasn't good enough https://lore.kernel.org/lkml/1567048502-6064-1-git-send-email-jing-ting.wu@mediatek.com/ The approach in that patch modified RT to avoid CFS actually. Can you verify whether the RT task woke up after task 34512 was migrated to CPU 17? Looking at the definition of available_idle_cpu() we should have avoided that CPU if the RT task was already running. Both waking up at the same time would explain what you see. Otherwise I'm not sure why it picked CPU 17. Thanks -- Qais Yousef