Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp1783138pxb; Thu, 14 Apr 2022 14:03:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwjkexqdnTlzyUoO957zVdWjz71tf+CWn7DyeHZtkt157fti7+/A9fCI71RW/DzaXnWGYlF X-Received: by 2002:a17:903:1249:b0:154:c472:de76 with SMTP id u9-20020a170903124900b00154c472de76mr49096499plh.81.1649970227052; Thu, 14 Apr 2022 14:03:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649970227; cv=none; d=google.com; s=arc-20160816; b=YV7SLR9E/CV13V+mbDFmCphJ7UWtvztzwhRlhY+/Lmp6chtCGK8KPDmtu5XnBTrk2/ fDirio8lYcwjSfyAYQBmDbHn5h5czmWLvfICiUdcUPZ3XIhP9F1uHdnED335g2MM9/b4 yDZx6rv2pOR6juEY2Hdi4oBO3VpodjzFCAk6M1h3YChnhvpSDexBz67HgFLF85/UoptC dpF5YiJl6QAfmFFUpRSeNp0gZ9OWb5rvKr581Bk4uJ/HEiEMrIzJRaZ2R88xxfaS9HUe 56VfP2t27RT3AEHoXgizKWFHQpPIkkP7025dDHsl3PKKoqogLRfpdnFu9RYpMZiUG/Cz Y1Mw== 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=bDa3LynvAWi9G+t+qDhkZRMBEIo8Z9HoZR7DqBkZoTw=; b=EJcHmj/Etr9o5pnR9nDsGHFNM95Kj2040C9amhqFY7Z1zH/eb8R0xp1FOAO3qKKzSl 9ijgaQr4oH4mbVraRPAJ91W6MCBIGMvvvRpXNF+27lpTDp1rUjU18Oa06skrhV1PeNqn SU/iZPvHrD2F+lq1KDCughc0lxx0pSqtWofYRKIg3AXjD3RrpE2mo9bxdhuGc2ecJ2wn lhSpSuAmJYV0527C7ZVAJBmGwlUnYna/dOrqqPQGsWHRHm69Lp3zDx5jdYEDUCUQYBt0 VphkEzkM+oeFUpcY0+RJ0u8lcDXQkrcCVpr7obIc8OEnemXMA0NTSEqMY44RzXpYng4f eKEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=An3vk4uE; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w14-20020a63af0e000000b0038228eaa3fdsi9668124pge.648.2022.04.14.14.03.13; Thu, 14 Apr 2022 14:03:47 -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; dkim=pass header.i=@linaro.org header.s=google header.b=An3vk4uE; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242213AbiDNKUD (ORCPT + 99 others); Thu, 14 Apr 2022 06:20:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60744 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242173AbiDNKTS (ORCPT ); Thu, 14 Apr 2022 06:19:18 -0400 Received: from mail-yb1-xb2d.google.com (mail-yb1-xb2d.google.com [IPv6:2607:f8b0:4864:20::b2d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C36DE71A06 for ; Thu, 14 Apr 2022 03:16:49 -0700 (PDT) Received: by mail-yb1-xb2d.google.com with SMTP id i20so8531867ybj.7 for ; Thu, 14 Apr 2022 03:16:49 -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=bDa3LynvAWi9G+t+qDhkZRMBEIo8Z9HoZR7DqBkZoTw=; b=An3vk4uE3ZKFrbF1hAOQIl6/JG9QKiJVxe6AxjV0nZqCr7Kz/Wi2u5+nxew/idPPIZ ESqg8cvJZoA+AYHcMR4JVf9zGir9PAvp2JoCFjEf8mcgB9GyfpqpP4B1iVrpSyPuduuZ RavZ/OOL563MxsK7nV5k5VtBQivOPW/Yz2qpYSI7mNwgweHB8WtspbsP1BVf3RsUin+s YvIiKnRjh1vW2Zply5d++0ktoQz4n2Pt8KQnJnhh9e7aLF+m1psDF6Ky8+4T/w5YQ2Wb ljK0k4qKcb9IOjJ1kx23YYbzw2AHxEIWkplQlsWSjXe4xGMit3B7iJpNlACbJwS88dBf RxxQ== 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=bDa3LynvAWi9G+t+qDhkZRMBEIo8Z9HoZR7DqBkZoTw=; b=pEkJLT28NUgDxR29cbXe8hYsikzN3PcI3/2c/IXvtgJ2eeYbww7x4mJqAXnCbTOSzT uWMOBFf0eol+vQH/bDDKgChxWCrHSrzUxAy9ntH4l8AOqqqhgXVlImzS5r6Eb/d1QZTL VKPxjdcFXtpJbUuNAcevqtJ50PDeP5+wslscBdRC312mKf7ErAP5xgzrOshqgA5AlKlM rqzv/FwGF18dTGTHNHDgpoKkzzodHIm5nvoGqOuiQAuBbTodv36qrRX5CxOVB68b8f36 jUxSw0zwv0kx74w8t4jDhlOVZMlAll/qftjkRAUi99jYjcusbB/DWpQFcaZglXTbV5D1 gMog== X-Gm-Message-State: AOAM532hxXypFLBdQ3DUTn62t6mVAuiuyNwmucDWX/tsmNJ+lRreRsGO qzDkXGajOnY317Zp1rKDhf+6wgelcGSkLYuqRV++mw== X-Received: by 2002:a25:e703:0:b0:641:f7ba:cda7 with SMTP id e3-20020a25e703000000b00641f7bacda7mr812557ybh.211.1649931408712; Thu, 14 Apr 2022 03:16:48 -0700 (PDT) MIME-Version: 1.0 References: <030aacb0c1304e43ab917924dcf4f138@AcuMS.aculab.com> <20220411233447.rcencjivkhyltyxm@airbuntu> <4ca5cd70904d47bea0df93f7c0979c66@AcuMS.aculab.com> <20220413235719.xs72pm2kgihia46g@airbuntu> <2956e0e1bbfe4309a749ebb3c8736799@AcuMS.aculab.com> In-Reply-To: <2956e0e1bbfe4309a749ebb3c8736799@AcuMS.aculab.com> From: Vincent Guittot Date: Thu, 14 Apr 2022 12:16:37 +0200 Message-ID: Subject: Re: Scheduling tasks on idle cpu To: David Laight Cc: Qais Yousef , 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 Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, 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 Thu, 14 Apr 2022 at 10:35, David Laight wrote: > > From: Vincent Guittot > > Sent: 14 April 2022 08:54 > > > > On Thu, 14 Apr 2022 at 01:57, Qais Yousef wrote: > > > > > > On 04/12/22 11:07, Vincent Guittot wrote: > > > > On Tue, 12 Apr 2022 at 10:39, David Laight wrote: > > > > > Yes I want the CFS scheduler to pick an idle cpu in preference > > > > > to an active RT one. > > > > > > > > When task 34512 wakes up, scheduler checks if prev or this cpu are > > > > idle which is not the case for you. Then, it compares the load of prev > > > > and this_cpu and seems to select this_cpu (cpu17). > > > > > > > > Once cpu17 selected, it will try to find an idle cpu which shares LLC > > > > but it seems that the scheduler didn't find one and finally keeps task > > > > 34512 on this_cpu. > > > > > > > > Note that during the next tick, a load balance will be trigger if > > > > this_cpu still have both RT and task 34512, > > > > > > David said there are idle cpus > > > > > > " There are two physical cpu with 20 cores each (with hyperthreading). > > > 16, 18, 34, 36 and 38 were idle. So both 16 and 18 should be on the > > > same NUMA node. All the others are running the same RT thread code. " > > > > > > Except for the possibility of them becoming idle just after the task has woken > > > up, shouldn't one of them have been picked? > > > > we don't loop on all cpus in the LLC to find an idle one but compute a > > reasonable number of iteration based on the avg_idle > > Is there a way to dump the kernel NUMA/LLC tables? > This might be relevant (with everything idle): > # cat /proc/schedstat > version 15 > timestamp 5388989193 > cpu0 0 0 0 0 0 0 117226041384582 250531565354 206276873 > domain0 00,00100001 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 > domain1 55,55555555 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 > domain2 ff,ffffffff 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 > cpu1 0 0 0 0 0 0 115978661288718 251736933814 297093280 > domain0 00,00200002 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 > domain1 aa,aaaaaaaa 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 > domain2 ff,ffffffff 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 > All the later cpu follow the same pattern (domain0 shifts left every cpu). > > I could interpret that as meaning: > cpu n and (n + 20) are the hyperthreading pairs. > Even numbered cpu are on one chip, odd numbered on the other. > > The migrate was: > 34533 [017]: sched_migrate_task: pid=34512 prio=120 orig_cpu=14 dest_cpu=17 > All the idle cpu were even. > > > David can rerun is use case after disabling sched_feat(SIS_PROP) > > How would I do that? echo NO_SIS_PROP > /sys/kernel/debug/sched/features > > David > > - > Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK > Registration No: 1397386 (Wales)