Received: by 2002:a25:23cc:0:0:0:0:0 with SMTP id j195csp19290ybj; Fri, 8 May 2020 05:39:10 -0700 (PDT) X-Google-Smtp-Source: APiQypJVx/3OH/2Oe4ofRwXN2xgRJ0QFaMJtGrKU6DNVDie8qmLdw54E+b5OooAz40YZ2ly6nNjX X-Received: by 2002:a17:907:2069:: with SMTP id qp9mr1749974ejb.137.1588941550273; Fri, 08 May 2020 05:39:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588941550; cv=none; d=google.com; s=arc-20160816; b=HZRj07cqevH5b37lAzZczffU1E8s+a4yRKwXTYtvxUPAEPPTTBk8WgL9ZsroXv2g76 HcHzRPk1XLLLca6Od8n7OUA1xglPd9s2s4+NXfraEYcRs7cT+W7W4EkySb++bpNA3BEA ZwWm6TgZx1/i7cJ8ospe32gRE6Me+j9+JS+mqiFhLvdyztKP99niVKqgHrjBo2ThnLNX ha8pg21km61xqdfadirNL888hvErIiMjf8udP4yV+guZQflnFu15OktN/gyN/Z5VTOZN mGfDMOJzfyf2186slE0Aw7kTfHzDglpF4mfBwwMkbiBOiYoAscuLtbGG+hzvGqzmrMKF 0WGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=kreOYKVsIzAvkcbQdsTFY9ySc69oBnN2FD6hCydX61g=; b=bM0VwfbwMWQ4vGwNjdtzipWdscyNbkZA/eybft1NbJ4U5DglODINsfP1fqcVPmc++f eeD+tfkPLcnhDHUKgOFFnhv1vqKlT4sLltEtH/f8R8nGhrPfKcUDj2r2m7MdUEtQwSdG j3GZJcHq6sl7xCd46G2v238RXbTFCzceEyW5egIfl6uildJS2LSr0vp6kdtHUi6CjpM0 hycAaLemoWhlj6kfYoZaJTui+i3YLCz0BPjuN16UJa0kYq+utxnrSz68MbjOuPhX9gg+ XHkPRQxbbpIbQVqTfmu4UYYjv3ox7YFiah6kS7O+Uu13qPjDAYhWQkjj86p/5nrnIc2X u9Fg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Y4rGUFQc; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d8si826278edq.328.2020.05.08.05.38.47; Fri, 08 May 2020 05:39:10 -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=@gmail.com header.s=20161025 header.b=Y4rGUFQc; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726767AbgEHMfI (ORCPT + 99 others); Fri, 8 May 2020 08:35:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58184 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726616AbgEHMfI (ORCPT ); Fri, 8 May 2020 08:35:08 -0400 Received: from mail-pj1-x1044.google.com (mail-pj1-x1044.google.com [IPv6:2607:f8b0:4864:20::1044]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 181BCC05BD43 for ; Fri, 8 May 2020 05:35:08 -0700 (PDT) Received: by mail-pj1-x1044.google.com with SMTP id fu13so4197834pjb.5 for ; Fri, 08 May 2020 05:35:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=kreOYKVsIzAvkcbQdsTFY9ySc69oBnN2FD6hCydX61g=; b=Y4rGUFQcqxXiIDwR/XcZi4P4JsTupK4Q2qDAhNaWB+CtPyDJIIb+BB8PastI322cqi 84+OQFdxHLvjq6CHPm3O5/UrTrKcOpUsNEl3Md18SVjUIMJ8+Q0tOO7vLsQ2oDKWLyzL HXxlbCliHLNAdnLXsLueMxjEvQjeKEGACqCg4YH5A0jtJ863WVr16sTgntez0q2aykR2 AldsHUmv2dEMosy2UGBMyGdIyzq8O1oDXR30c7BIv6BRcJUXbQAR93rPafj/Lh7pU8rj cvSwfD9H1vAjGcKmkXy4HKyAGehNvgw44OnIzmSE8JY7isatMgGH9QfxUA7G95Kom7DH r0Yw== 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=kreOYKVsIzAvkcbQdsTFY9ySc69oBnN2FD6hCydX61g=; b=c0jBjctcGaws1SnU2RVf8EFOqwyC4I7Az4xZJbwSJ9MAhSv7pNrhUTa+Mxg+OZ5k6I PBLvH5xc3QQNWtSUHrXEDxOXZhhnZXAZ3WDreXL3eKw7RWDMy6fn/BTFl8ujFTUTjquo ziDqedUEbqdejsbpnCE95ZaGWn00uWmWuo5zBFMSwLljIrKGe+Y5kfI6isa/GFcJ8J9g mtCt0qjCJzeSm4D1sVSkdyuJ1VCwNPGIqRsKq2z2Xy/+jLoG3zDN4KsciJss2QU7ov2r tk4y1mjeMd3gQ5zZVHaw1WpxS/JE7NFfSazBc/DCS+9TmFH45155/7NCpz7FJW1PkKtf it5Q== X-Gm-Message-State: AGi0PuaKfhyPDUWmamhC2MTvImp+Adcpj5XcYe+dylwTZYQkY+m/Jg9N VI52yyYskVD/7D6Dgg5EgNlQlXsPhoY= X-Received: by 2002:a17:90a:2709:: with SMTP id o9mr5499773pje.168.1588941307612; Fri, 08 May 2020 05:35:07 -0700 (PDT) Received: from aaronlu-desktop ([47.89.83.64]) by smtp.gmail.com with ESMTPSA id m3sm2329490pjs.17.2020.05.08.05.35.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 May 2020 05:35:06 -0700 (PDT) Date: Fri, 8 May 2020 20:34:57 +0800 From: Aaron Lu To: Peter Zijlstra Cc: Vineeth Remanan Pillai , Nishanth Aravamudan , Julien Desfossez , Tim Chen , Ingo Molnar , Thomas Gleixner , Paul Turner , Linus Torvalds , Aaron Lu , Linux List Kernel Mailing , =?iso-8859-1?Q?Fr=E9d=E9ric?= Weisbecker , Kees Cook , Greg Kerr , Phil Auld , Aubrey Li , "Li, Aubrey" , Valentin Schneider , Mel Gorman , Pawan Gupta , Paolo Bonzini , Joel Fernandes , Joel Fernandes Subject: Re: [PATCH updated v2] sched/fair: core wide cfs task priority comparison Message-ID: <20200508123457.GA122180@aaronlu-desktop> References: <20200415040741.GA169001@ziqianlu-desktop.localdomain> <20200417094045.GA197704@ziqianlu-desktop.localdomain> <20200420080759.GA224731@ziqianlu-desktop.localdomain> <20200421025131.GA227300@aaronlu-desktop> <20200424142443.GA263207@aaronlu-desktop> <20200506143506.GH5298@hirez.programming.kicks-ass.net> <20200508084419.GA120223@aaronlu-desktop> <20200508090925.GV5298@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200508090925.GV5298@hirez.programming.kicks-ass.net> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, May 08, 2020 at 11:09:25AM +0200, Peter Zijlstra wrote: > On Fri, May 08, 2020 at 04:44:19PM +0800, Aaron Lu wrote: > > On Wed, May 06, 2020 at 04:35:06PM +0200, Peter Zijlstra wrote: > > > > Aside from this being way to complicated for what it does -- you > > > could've saved the min_vruntime for each rq and compared them with > > > subtraction -- it is also terminally broken afaict. > > > > > > Consider any infeasible weight scenario. Take for instance two tasks, > > > each bound to their respective sibling, one with weight 1 and one with > > > weight 2. Then the lower weight task will run ahead of the higher weight > > > task without bound. > > > > I don't follow how this could happen. Even the lower weight task runs > > first, after some time, the higher weight task will get its turn and > > from then on, the higher weight task will get more chance to run(due to > > its higher weight and thus, slower accumulation of vruntime). > > That seems to assume they're mutually exclusive. In that case, as I > argued, we only have a single runqueue and then yes it works. But if > they're not exclusive, and can run concurrently, it comes apart. Ah right, now I see what you mean. Sorry for misunderstanding. And yes, that 'utterly destroys the concept of a shared time base' and then bad things can happen: 1) two same tagged tasks(t1 and t2) running on two siblings, with t1's weight lower than t2's; 2) both tasks are cpu intensive; 3) over time, the lower weight task(t1)'s vruntime becomes bigger and bigger than t2's vruntime and the core wide min_vruntime is the same as t1's vruntime per this patch; 4) a new task enqueued on the same sibling as t1, if the new task has an incompatible tag, it will be starved by t2 because t2's vruntime is way smaller than the core wide min_vruntime. With this said, I realized a workaround for the issue described above: when the core went from 'compatible mode'(step 1-3) to 'incompatible mode'(step 4), reset all root level sched entities' vruntime to be the same as the core wide min_vruntime. After all, the core is transforming from two runqueue mode to single runqueue mode... I think this can solve the issue to some extent but I may miss other scenarios. I'll also re-read your last email about the 'lag' idea.