Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp4332500ybp; Mon, 14 Oct 2019 03:01:03 -0700 (PDT) X-Google-Smtp-Source: APXvYqwSlG6DKpuuBCWNOI5NXINH1qlt8S2IBbMZ+4B55BTSABuYU4JdgaAdfg8UOquz8tk8IRrm X-Received: by 2002:aa7:df95:: with SMTP id b21mr26701352edy.16.1571047263633; Mon, 14 Oct 2019 03:01:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571047263; cv=none; d=google.com; s=arc-20160816; b=VDGHteRqH+VvI1HYvr3cVWTqiNzDIxaHK/lMVHrY9XaHOd7p/99Von4H4IpSYfmIbf F3x24Xz25+KWPFgnBXa16NjAA082EJwCOaiw6m19glfzYXHlUBvRjg7IcDx7E1r9Kkv0 GcgJeEeiehQsBUfOikVdkWXN/thvmml5syQTwHGzHLcOpkG4yJ56i2cGPIZI8F5kV9TV MKnVR5SzF/u/tNKZOSJBnt6kGSJbXUtO/Xv4X0xOw2WyqP105LnNuFF375G5LYm9/YRF bOfFPp8S8kuemj6GM5xR17xGBvV0ahujq/rFZPirDluRLhxXwlZDLXzZIZIuwWbuXLzU 7hZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=fjX8oF0u6VJSM8tK5iZ6IYd+tVCLgWXNSkmgIj7UJ6k=; b=HlpN5M3vPjZq+hLJchkNRge05xs78k6ua3xHJieAr9cloyRluryk9ES6mlrs644o8L cfEsttYVoKMOBXgPNQ+Dm1ssoNXuSwy4HCJBZzrNuhxeue2gAfE72BDKa52NsgIBHylK hK/7WagudDwBIRongUduJ5qg96KOjeCORNv6gy3uHnNzoGdV80GY3H1l1FE20JLuvxkU cne5MB/zmN81ldjw+1TeHYrh+SGUmDO9CgJh4txjoihPfrqUnwZJeaZWFRDDinPf1KaZ p3B3ppAqRa5GYm8cL3YkYG/XxsANIGVxn/ZlTc8TzxbyVA1tuHp5CtDjlXDKgXFsYgUo NR2w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v5si11277724edm.313.2019.10.14.03.00.39; Mon, 14 Oct 2019 03:01:03 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731171AbfJNJ5h (ORCPT + 99 others); Mon, 14 Oct 2019 05:57:37 -0400 Received: from out30-130.freemail.mail.aliyun.com ([115.124.30.130]:37502 "EHLO out30-130.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731132AbfJNJ5h (ORCPT ); Mon, 14 Oct 2019 05:57:37 -0400 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R201e4;CH=green;DM=||false|;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04395;MF=aaron.lu@linux.alibaba.com;NM=1;PH=DS;RN=21;SR=0;TI=SMTPD_---0Tf.EEyp_1571047045; Received: from aaronlu(mailfrom:aaron.lu@linux.alibaba.com fp:SMTPD_---0Tf.EEyp_1571047045) by smtp.aliyun-inc.com(127.0.0.1); Mon, 14 Oct 2019 17:57:31 +0800 Date: Mon, 14 Oct 2019 17:57:25 +0800 From: Aaron Lu To: Vineeth Remanan Pillai Cc: Tim Chen , Julien Desfossez , Dario Faggioli , "Li, Aubrey" , Aubrey Li , Nishanth Aravamudan , Peter Zijlstra , Ingo Molnar , Thomas Gleixner , Paul Turner , Linus Torvalds , Linux List Kernel Mailing , =?iso-8859-1?Q?Fr=E9d=E9ric?= Weisbecker , Kees Cook , Greg Kerr , Phil Auld , Valentin Schneider , Mel Gorman , Pawan Gupta , Paolo Bonzini Subject: Re: [RFC PATCH v3 00/16] Core scheduling v3 Message-ID: <20191014095725.GA78693@aaronlu> References: <20191010135436.GA67897@aaronlu> <20191011073338.GA125778@aaronlu> <20191011114851.GA8750@aaronlu> <20191012035503.GA113034@aaronlu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Oct 13, 2019 at 08:44:32AM -0400, Vineeth Remanan Pillai wrote: > On Fri, Oct 11, 2019 at 11:55 PM Aaron Lu wrote: > > > > > I don't think we need do the normalization afterwrads and it appears > > we are on the same page regarding core wide vruntime. Should be "we are not on the same page..." [...] > > The weird thing about my patch is, the min_vruntime is often increased, > > it doesn't point to the smallest value as in a traditional cfs_rq. This > > probabaly can be changed to follow the tradition, I don't quite remember > > why I did this, will need to check this some time later. > > Yeah, I noticed this. In my patch, I had already accounted for this and changed > to min() instead of max() which is more logical that min_vruntime should be the > minimum of both the run queue. I now remembered why I used max(). Assume rq1 and rq2's min_vruntime are both at 2000 and the core wide min_vruntime is also 2000. Also assume both runqueues are empty at the moment. Then task t1 is queued to rq1 and runs for a long time while rq2 keeps empty. rq1's min_vruntime will be incremented all the time while the core wide min_vruntime stays at 2000 if min() is used. Then when another task gets queued to rq2, it will get really large unfair boost by using a much smaller min_vruntime as its base. To fix this, either max() is used as is done in my patch, or adjust rq2's min_vruntime to be the same as rq1's on each update_core_cfs_min_vruntime() when rq2 is found empty and then use min() to get the core wide min_vruntime. Looks not worth the trouble to use min().