Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp2824603rdb; Tue, 12 Sep 2023 13:18:43 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEzVNGFstf1z9cj1nwQRWfv+ZmOPy/WCPtLENqnynaUb7kKopY/5avPT18oWqzqdo4vqDvK X-Received: by 2002:a05:6a20:8e03:b0:14e:429e:b0e3 with SMTP id y3-20020a056a208e0300b0014e429eb0e3mr584795pzj.52.1694549923393; Tue, 12 Sep 2023 13:18:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694549923; cv=none; d=google.com; s=arc-20160816; b=lHEEc44/bUgT94QFpAq7hQxvqhEda6rIDyLk0hjU2DZpu6AtgKpg7Ga5L+bp6hY1DG y26m5PPZA24J0Z144ww6471YyKOfEHSruosTno0hEI0uBZML3D3ZVnJkkePp9s/hX/Uq MRqdEGIFYSADeV1ZApJnk3mieoMlb+v+MBnHmGsi6dtMXPxGYscSBLpAAsosElftY3OL u7vWtLn3ffjEZzSdmkON9x+xs38yojSwwu90HiIuPqGnHVpYRfvdk57ecar2cjJJYsax 4xd0ZH59yHAfgwgtQ0uzFBnHiR+p0pzSxm4Y4WiW+lcaAPRLWhqVQjALFGLj+K0lsn4L 0NUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:ui-outboundreport:content-transfer-encoding :mime-version:user-agent:references:in-reply-to:date:cc:to:from :subject:message-id:dkim-signature; bh=AB8lipmrYt7dJn3c4Le2bjMq+z5+OKz2ulsAPWnu6KU=; fh=2/ISi0U2du5eNVD1P0j0kS6vlYbdS3o/UFwLok7fYLE=; b=D9o2zF4jBQsothaPR0vsLLLGIWU/s8NNYjjyNr9fnzGD2IwjYmF5nZYf8aTYufbF5Z XdbvHVf8aDkjUl9VgGhjnFewrMWY85AuoQjVVBd+/MI7V7axSzbajEdx0x960Z4eqo3F szX/0j+ru21UydDLLhVOz9bgECJPJRHXVy5zI0SnzlKKsnCLsn6AaZ397TYTKgysXV0e uxq3oduiFx4q0d19UyjQuqZoyysZBQAW2fbk1POmuvPn/XRS1Qe+fkdZo+2yKxsYs5ov mgDb404/Oh+fbgkKQvv4GrkxqtWS0E016HJw4pFj4/mJ0BgEhSPefNquErR8kIljrI0W o54w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmx.de header.s=s31663417 header.b=jiLamhHB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmx.de Return-Path: Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id pg9-20020a17090b1e0900b0026f3e1e9639si13773pjb.40.2023.09.12.13.18.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Sep 2023 13:18:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@gmx.de header.s=s31663417 header.b=jiLamhHB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmx.de Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id ABDAF827AFA4; Mon, 11 Sep 2023 23:32:49 -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 S229944AbjILGcv (ORCPT + 99 others); Tue, 12 Sep 2023 02:32:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59462 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229479AbjILGct (ORCPT ); Tue, 12 Sep 2023 02:32:49 -0400 Received: from mout.gmx.net (mout.gmx.net [212.227.15.15]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B7F9EE75 for ; Mon, 11 Sep 2023 23:32:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.de; s=s31663417; t=1694500337; x=1695105137; i=efault@gmx.de; bh=nuIHS0Ni8crXNhVzrCs+py4QjluvVcl8qgxbKXCu9Xg=; h=X-UI-Sender-Class:Subject:From:To:Cc:Date:In-Reply-To:References; b=jiLamhHBL+hpm60DseLpNa3j9QpXthGBhwZbxlSHfjqcax4J5PLJ8NM3mj7BcWGfKBk93WY S+oJMlj9tdGwxEhsA+vM+7iXeDGw6y6o/8KWYUDAqDLu3RPOxEbrRG95ucTLL97+v69nptQTU kkiKPkezetn9uGDcia8xK0O2MG+lOfGBsjgWO7AjLb9QsJqwTBPAlqrtE1M7g9DJEce+jaZTG yFRmTVR1GNfULp/vmPYu1YEmlr0CayzM/m7vL3bhM6D9qLSejMIIPl3tAmyUcqnqZ3onPUNU2 wRgCbp1TOoWvse0ljI7hkepx04+M3oaZC3yViZyp6WVm9RdN6Z8A== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from homer.fritz.box ([185.221.151.115]) by mail.gmx.net (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1M3DJv-1qjWma2ngj-003dVt; Tue, 12 Sep 2023 08:32:17 +0200 Message-ID: <030b279a19a2c5929972b9b56cce40f4f919ed20.camel@gmx.de> Subject: Re: [RFC PATCH 2/2] sched/fair: skip the cache hot CPU in select_idle_cpu() From: Mike Galbraith To: K Prateek Nayak , Chen Yu Cc: Tim Chen , Aaron Lu , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira , Valentin Schneider , "Gautham R . Shenoy" , linux-kernel@vger.kernel.org, Peter Zijlstra , Mathieu Desnoyers , Ingo Molnar , Vincent Guittot , Juri Lelli Date: Tue, 12 Sep 2023 08:32:13 +0200 In-Reply-To: <31c910c2-717d-b86c-4e08-5c94383682e8@amd.com> References: <31c910c2-717d-b86c-4e08-5c94383682e8@amd.com> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.42.4 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:EP3WJNbdA81CrlRkD8fNl0h6ZXHGAm0HApSK9GneZZd68s8bJZf IsULSibIJlK9OAgsfwiIzQ/SVSxoiEL96jsVSAKsQwnFC2V/9ZEUTcfv+g1INcXAPnADzUF LiNmXYxFo3yPxoI8aDfCk+3GXu0kt4JY2tK55egumKo/PJ3kOnTKjipjRC/XtnRUpvKCBcn 6zElUfQMIhjUBqo/WszXw== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:l+XgMITDllE=;AlCVDOBJPJlF70r3iZ7myLOq3H8 XDjJ01hYYljGPD9eZd/AtEs4IPGg+j7jCGKykd6C/AzhZ71AAwwvPjUvp4+Dip3SqIFDAmcbk PZ8OLayRF4RxWq0hDBCQR4YVRVs5tzHqde/NxwEQogqABVF+fBKP4fhKSP9jBZfKpx1dusI9c LmYZjYGxukYUJhvvjJGqDF6li9hZp6x8gLOTfMXzWeqsmtrVESbXH6/LBLKZDBXw5ixgqyg8i g0iv6hbcDDL2gIofXImhHDSIEW0LW6mz43YDOQYBPgkn3TaXbQ4NVMOu9JF6XoprK33/zcOeP K2cLZMTqiiMc0/2ec826xkR/yKxytX7+6XiXqirrOicDn+jjNJYbjKbL1iRTjfwDi8Rz0R1So XjPdCH+vtmC73es2fpV3Hl1RdnzO1+LjJVvS6joxUW+H7sMYko/8nG3c/TsuSxB0O2CaKOc9n 2P7GZSQZhiHLfwwmIApqQ4o9jjhSoD3aSR3ybW87gPFsm1fYc9C0gYl8r+eKgqKnF/5Vxw2t+ jpR15dzjk7sTsf6sw/1IJvKF9E6alQhhq5HSMoxnCbM8L2Fu4mzTZmZUd/I17+iXt4MRucY+s 6uypBenJ/eEp00SNUv1XRjBt8BPNdp2rRBJJys4jCHgnrj7ywmfLiU5zSWWGodKbw3DG+XPqx GqwNWS1BOgpD5rQZpwAqO/oBEZF8Cd2oSX1TTd47XIswt4oVrT8uQyi9UMyxRoADSx7kQXkI7 Mr6AbDQK4pJmjHAPW5Z3BHthwty0nZjRAIw416ctnsqPbwSn/QSsamEE7BLQHV5gzgGR5Tflp ulpPE1K1D3H/A6TFO9sF9FagZYO8N3bUnVfpNRStE3pVE9anZl/ug0szIc1ZGLIdzd5ORaiLn 11xycioYdiTKGG9x20QAR+cr7tHQDiiRYCFycCUaTpYodNJySNehEcKPs9CLlhx2Sgti3tZla XQHJ6Z1LcwF0CilcdxjfiPGDoGw= 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, 11 Sep 2023 23:32:49 -0700 (PDT) On Mon, 2023-09-11 at 13:59 +0530, K Prateek Nayak wrote: > > Speaking of cache-hot idle CPU, is netperf actually more happy with > piling on current CPU? Some tests would be happier, others not at all, some numbers below. I doubt much in the real world can perform better stacked, to be a win, stacked task overlap induced service latency and utilization loss has to be less than cache population cost of an idle CPU, something that modern CPUs have become darn good at, making for a high bar. > I ask this because the logic seems to be > reserving the previous CPU for a task that dislikes migration but I > do not see anything in the wake_affine_idle() path that would make the > short sleeper proactively choose the previous CPU when the wakeup is > marked with the WF_SYNC flag. Let me know if I'm missing something? If select_idle_sibling() didn't intervene, the wake affine logic would indeed routinely step all over working sets, and at one time briefly did so due to a silly bug. (see kernel/sched/fair.c.today:7292) The sync hint stems from the bad old days of SMP when cross-cpu latency was horrid, and has lost much of its value, but its bias toward the waker CPU still helps reduce man-in-the-middle latency in a busy box, which can do even more damage than that done by stacking of not really synchronous tasks that can be seen below. The TCP/UDP_RR tests are very close to synchronous, and the numbers reflect that, stacking is unbeatable for them [1], but for the other tests, hopefully doing something a bit more realistic than tiny ball ping-pong, stacking is a demonstrable loser. Not super carefully run script output: homer:/root # netperf.sh TCP_SENDFILE-1 unbound Avg: 87889 Sum: 87889 TCP_SENDFILE-1 stacked Avg: 62885 Sum: 62885 TCP_SENDFILE-1 cross-smt Avg: 58887 Sum: 58887 TCP_SENDFILE-1 cross-core Avg: 90673 Sum: 90673 TCP_STREAM-1 unbound Avg: 71858 Sum: 71858 TCP_STREAM-1 stacked Avg: 58883 Sum: 58883 TCP_STREAM-1 cross-smt Avg: 49345 Sum: 49345 TCP_STREAM-1 cross-core Avg: 72346 Sum: 72346 TCP_MAERTS-1 unbound Avg: 73890 Sum: 73890 TCP_MAERTS-1 stacked Avg: 60682 Sum: 60682 TCP_MAERTS-1 cross-smt Avg: 49868 Sum: 49868 TCP_MAERTS-1 cross-core Avg: 73343 Sum: 73343 UDP_STREAM-1 unbound Avg: 99442 Sum: 99442 UDP_STREAM-1 stacked Avg: 85319 Sum: 85319 UDP_STREAM-1 cross-smt Avg: 63239 Sum: 63239 UDP_STREAM-1 cross-core Avg: 99102 Sum: 99102 TCP_RR-1 unbound Avg: 200833 Sum: 200833 TCP_RR-1 stacked Avg: 243733 Sum: 243733 TCP_RR-1 cross-smt Avg: 138507 Sum: 138507 TCP_RR-1 cross-core Avg: 210404 Sum: 210404 UDP_RR-1 unbound Avg: 252575 Sum: 252575 UDP_RR-1 stacked Avg: 273081 Sum: 273081 UDP_RR-1 cross-smt Avg: 168448 Sum: 168448 UDP_RR-1 cross-core Avg: 264124 Sum: 264124 1. nearly unbeatable - shared L2 CPUS can by a wee bit.