From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.9 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C2654C4363D for ; Wed, 23 Sep 2020 01:52:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 627BD2371F for ; Wed, 23 Sep 2020 01:52:47 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=joelfernandes.org header.i=@joelfernandes.org header.b="VvuUIR5Z" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727003AbgIWBwq (ORCPT ); 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-Google-Smtp-Source: ABdhPJxgKWcg0mc8n85Ep1u/caKCmAyXiog5710ndV0MWbdPjZK/e9jBQ/vJtZQGZaZ8QHtfZVgVDA== 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