Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp86569pxk; Tue, 22 Sep 2020 19:46:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyN0JuxAOh+C6BzgsGZO8DoYRYMqUhsEvVZh5ClqiEB8T5ibwgjNjywLcBfGrxlGLU/6HnT X-Received: by 2002:a50:f1cf:: with SMTP id y15mr7393590edl.204.1600829160770; Tue, 22 Sep 2020 19:46:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600829160; cv=none; d=google.com; s=arc-20160816; b=qXHkR0q2Xpn/yLOSJdm+pS2JAynU04bbWxamwP/GH32QYYy20KnsjUrgw9ywOFbBl8 ZLVf+MQyoc6E35/RjReXayyBq7PyfoHV65GY0E5yR5YchT+d4Za6lchqjNtcjIpi5Lbj zWWipB/SmV0yTPPexN7/HutQ4k8ZFiUcBNGoGENaWcrs//1dCNUMAOPSw+0/qH2/b17F MnJskafDgOOf6Nu7GgVzdhHnImZV8lONdyC9AdrQ52ECBA9MZ4mpLm221cS3Vjo0hWab dZo6NFd+7nBh6Tyv8YCwCCHUYLN+OMb0pgN97w2mOehenZmsv8nio8n3qT/D01X8eIZN NRUA== 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:dkim-signature; bh=TiMhTitM/Kckj6g33MjfhbkW3q6tpXUyaiKiQ5+I5GY=; b=RINnVDmc84SNjNVf65FxmkMkiVAmWMl7ZqJtRio9FWFGEj58G41FilR2YUvJpjoHLe IQWzGf6H2jAwVdU6eCSpzFcLwel/yakCPhIMz/Stxq4xzbfB0LW7ZQ0Gm2oFGV1/76yI ItgZmt+nkAOEoZfxOARjAahhB8soU02RV6Wb/JSFpZ1PxCYyk26/juGR3BQp6GwI+k3O ucR6Y+COUzXbKUHSzfat3zkny8zrrotfBUHRKTgvju15vtRYnp6aQkLa8VqvSwRG+FqA XwDyhfZPPF10Q24aCNOX2C7VpXy6QUu6HAbLQMuZYEXoYreRz3qPPbYkHbphYcQDzeUD xrXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=VvuUIR5Z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 40si12144892edr.35.2020.09.22.19.45.37; Tue, 22 Sep 2020 19:46:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=VvuUIR5Z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726952AbgIWBwq (ORCPT + 99 others); Tue, 22 Sep 2020 21:52:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58136 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726548AbgIWBwp (ORCPT ); Tue, 22 Sep 2020 21:52:45 -0400 Received: from mail-qk1-x742.google.com (mail-qk1-x742.google.com [IPv6:2607:f8b0:4864:20::742]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BF092C061755 for ; Tue, 22 Sep 2020 18:52:45 -0700 (PDT) Received: by mail-qk1-x742.google.com with SMTP id c62so8156235qke.1 for ; Tue, 22 Sep 2020 18:52:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joelfernandes.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=TiMhTitM/Kckj6g33MjfhbkW3q6tpXUyaiKiQ5+I5GY=; b=VvuUIR5ZaPC1iCrOrvxBVYEKcKXqPHB4WbOjaNt3fNglEa4Bt/Nj8P6qCw7ALpnqKm QVh/TLAtreIMNM9skUUnRILK4hz+fC5/F7hZ1s3ww9yH9e0JCatzuK1y4m9TPPJrOfry vEoLJ906+vM5tYaaHlXoCPIC5u7vuPwsrhMgc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=TiMhTitM/Kckj6g33MjfhbkW3q6tpXUyaiKiQ5+I5GY=; b=ubLhOB9rNyHxJFjytJkBJXgSW+xwxNVH+yQwn9euOqRl1l9blYi4xPpBdlGnpJxPOu DbLiEdS+r8r7EKYsxXxqIUKxQBqJxU/gc6SKxp+tXkB4IKMPPbvI1wgJW/Eu7CA6Leq8 XtlaZB2F5gc/zhghaHFlJ28WP9BbbtoO8NUcgYyPqd97wjHGh6eeM3K/cvw6XiyXFgl4 FcR9g9vqWWyUwV9t01T4TCbQDZVK0mHFCTBkPJekfc66WrR4iP7lfPupZpltIwJt7MDH 53QY6PnZocKcHjwSU+cb61ASQxp31p8YOm3SRHE8L1x+ZVx8YDdnM6X7ff55/XA4JEpz D77w== X-Gm-Message-State: AOAM532nNsGYOjov7X9b6PJrDF1Y/KidPaCwj8p0E2NYsgz6fJWnLcnF 4JT0EmZow1MrreIIlnK/n8TzFA== X-Received: by 2002:a37:a0cf:: with SMTP id j198mr3074886qke.408.1600825964757; Tue, 22 Sep 2020 18:52:44 -0700 (PDT) Received: from localhost ([2620:15c:6:12:cad3:ffff:feb3:bd59]) by smtp.gmail.com with ESMTPSA id f3sm13569003qtg.71.2020.09.22.18.52.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Sep 2020 18:52:44 -0700 (PDT) Date: Tue, 22 Sep 2020 21:52:43 -0400 From: Joel Fernandes To: Peter Zijlstra Cc: Julien Desfossez , Vineeth Pillai , Tim Chen , Aaron Lu , Aubrey Li , Dhaval Giani , Chris Hyser , Nishanth Aravamudan , mingo@kernel.org, tglx@linutronix.de, pjt@google.com, torvalds@linux-foundation.org, linux-kernel@vger.kernel.org, fweisbec@gmail.com, keescook@chromium.org, kerrnel@google.com, Phil Auld , Valentin Schneider , Mel Gorman , Pawan Gupta , Paolo Bonzini , vineeth@bitbyteword.org, Chen Yu , Christian Brauner , Agata Gruza , Antonio Gomez Iglesias , graf@amazon.com, konrad.wilk@oracle.com, dfaggioli@suse.com, rostedt@goodmis.org, derkling@google.com, benbjiang@tencent.com, Aaron Lu Subject: Re: [RFC PATCH v7 11/23] sched/fair: core wide cfs task priority comparison Message-ID: <20200923015243.GA1739137@google.com> References: <20200828212927.GE29142@worktop.programming.kicks-ass.net> <20200923014622.GA1733275@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200923014622.GA1733275@google.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 22, 2020 at 09:46:22PM -0400, Joel Fernandes wrote: > On Fri, Aug 28, 2020 at 11:29:27PM +0200, Peter Zijlstra wrote: > > > > > > This is still a horrible patch.. > > Hi Peter, > I wrote a new patch similar to this one and it fares much better in my tests, > it is based on Aaron's idea but I do the sync only during force-idle, and not > during enqueue. Also I yanked the whole 'core wide min_vruntime' crap. There > is a regressing test which improves quite a bit with my patch (results below): > > Aaron, Vineeth, Chris any other thoughts? This patch is based on Google's > 4.19 device kernel so will require some massaging to apply to mainline/v7 > series. I will provide an updated patch later based on v7 series. > > (Works only for SMT2, maybe we can generalize it more..) > --------8<----------- > > From: "Joel Fernandes (Google)" > Subject: [PATCH] sched: Sync the min_vruntime of cores when the system enters > force-idle > > This patch provides a vruntime based way to compare two cfs task's priority, be > it on the same cpu or different threads of the same core. > > It is based on Aaron Lu's patch with some important differences. Namely, > the vruntime is sync'ed only when the CPU goes into force-idle. Also I removed > the notion of core-wide min_vruntime. > > Also I don't care how long a cpu in a core is force idled, I do my sync > whenever the force idle starts essentially bringing both SMTs to a common time > base. After that point, selection can happen as usual. > > When running an Android audio test, with patch the perf sched latency output: > > ----------------------------------------------------------------------------------------------------------------- > Task | Runtime ms | Switches | Average delay ms | Maximum delay ms | Maximum delay at | > ----------------------------------------------------------------------------------------------------------------- > FinalizerDaemon:(2) | 23.969 ms | 969 | avg: 0.504 ms | max: 162.020 ms | max at: 1294.327339 s > HeapTaskDaemon:(3) | 2421.287 ms | 4733 | avg: 0.131 ms | max: 96.229 ms | max at: 1302.343366 s > adbd:(3) | 6.101 ms | 79 | avg: 1.105 ms | max: 84.923 ms | max at: 1294.431284 s > > Without this patch and with Aubrey's initial patch (in v5 series), the max delay looks much better: > > ----------------------------------------------------------------------------------------------------------------- > Task | Runtime ms | Switches | Average delay ms | Maximum delay ms | Maximum delay at | > ----------------------------------------------------------------------------------------------------------------- > HeapTaskDaemon:(2) | 2602.109 ms | 4025 | avg: 0.231 ms | max: 19.152 ms | max at: 522.903934 s > surfaceflinger:7478 | 18.994 ms | 1206 | avg: 0.189 ms | max: 17.375 ms | max at: 520.523061 s > ksoftirqd/3:30 | 0.093 ms | 5 | avg: 3.328 ms | max: 16.567 ms | max at: 522.903871 s I messed up the change log, just to clarify - the first result is without patch (bad) and the second result is with patch (good). thanks, - Joel