Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp4206565ybg; Mon, 21 Oct 2019 05:33:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqx1cEmb1KccCVf7Vu230+s8YCpZi4K9ZdpafFo5MTkKanPe//APXbe3dCLErbSR4uKkEx+F X-Received: by 2002:aa7:d145:: with SMTP id r5mr24268650edo.275.1571661222879; Mon, 21 Oct 2019 05:33:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571661222; cv=none; d=google.com; s=arc-20160816; b=Y2TQKZT0W145hF/mhBpJuICXck2gP7ol9wDy2bWiLwUkkbmAUIFsI6UCffx0IVuTAl Um/9g6zRchUCNiaFjNVGSUoRCwFPEXN4piOTcQefOYLNQmbWcA9uJJwgqkX9Klhk+NHZ m4lMX+RNLmp8XS8QHNWbLrGNIqUmibJIInk31E1zoZ+AHZD1XDoxyJArH2UKUMxZHBMx Li7IAykZnaw7+5ywqcZuCcMJzy26d4DId1qYXb+SPDaFn+04FuLXMX7ptJN87zcLLF1K KBOFeCssRdUk4/Vr453eAprqO6qgDkUsFoC2uaFudOG8DiXNGHBYzG5bTsNwTtPOL/f+ pnrQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=2CvQfJp0jZuEapaWIymH7i0ajtc/1eie3Idb6/0rzdk=; b=rGAacIH5VpefumtNWW4NnU4PLB/RgFH9eV/iWgdzkP4ogvcLXBYIsdzQ6sKq+2eGNn WxtciTWrndyzZolnZDLWATsScpO6EyY30uJ6A+gFBuT/XLDx9RIDkoG3HB+IVAQTo6yE 22RiC3+BvsUG9bdX4hX9Rl8/V9+GIG3qFhPe/ktG4r6eHhcji7q0+i3Isnu5Lm+Pw4yG wsD1zHzOq90rzZjxdEZCiwQyyaUo+NnY7dLiX4XUneuSPvP8qiAz5O6h/s01arYgyS1e pq8xO3VPdDs8aa/2TSXrWx+x4YnLLo563e0yqIEeeqQs8sQX7UyNvDQZvYHz79FRlCKQ HJFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@digitalocean.com header.s=google header.b=UXTT+DKD; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=digitalocean.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h52si5413988eda.21.2019.10.21.05.33.19; Mon, 21 Oct 2019 05:33:42 -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; dkim=pass header.i=@digitalocean.com header.s=google header.b=UXTT+DKD; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=digitalocean.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728739AbfJUMae (ORCPT + 99 others); Mon, 21 Oct 2019 08:30:34 -0400 Received: from mail-ot1-f65.google.com ([209.85.210.65]:35053 "EHLO mail-ot1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726767AbfJUMad (ORCPT ); Mon, 21 Oct 2019 08:30:33 -0400 Received: by mail-ot1-f65.google.com with SMTP id z6so10818841otb.2 for ; Mon, 21 Oct 2019 05:30:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=digitalocean.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=2CvQfJp0jZuEapaWIymH7i0ajtc/1eie3Idb6/0rzdk=; b=UXTT+DKD4aFgG0sPNlAE13Fiinq+4YhuM7PhQcg/qTjplekxUMkBaIeNnt8PqW74G9 wSD5FJMpIn+BnO0OPVESwSofnzghEdh+kkI52RlMdHKm1mJ8fwvyZFT3aPh0B9Wd64ul I+SWpM2QxPUmXIglB5YFksCvbwh8MylNguh4I= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=2CvQfJp0jZuEapaWIymH7i0ajtc/1eie3Idb6/0rzdk=; b=F7gXimk91/UBO+6sKU2Fql2fli+uK+oCrmpZjtkh6JMYGgNE5sGIgd53MMCjq6hilY 6Beu1pgODXUX1JTHSZWh4BX2lezknCSUXJpy/6PMeToWJrgzsUoP88xCPlb46k95jhor t87y8ZDIBPQ+jNTmvTbilwsESxOQqDLLGprs+vfweQIdiw2zGPb3yCsVclYTA/GysMYY /C9/NvE4KCXZuK+9eNI4EagnmDbqAMtC1gOSYw/20uMAVZeimbfvGOeJZ0B73eQUalj/ NcphPlKK+AktB2RUxBn5Kqc732Gx7d4IwtF41FJjqJR3KghtLbKo00aJM4Zg5h2efJPN CxVg== X-Gm-Message-State: APjAAAXeBGOxidZ1HthiK03CGg843PbqbNgq7vj5rDfop4T7vXj3tVsd tHdbYeCQJAtqM6lpaFNEg5zAqs5ktlL8PtQH/quqpQ== X-Received: by 2002:a9d:73c8:: with SMTP id m8mr19093933otk.75.1571661032652; Mon, 21 Oct 2019 05:30:32 -0700 (PDT) MIME-Version: 1.0 References: <20191010135436.GA67897@aaronlu> <20191011073338.GA125778@aaronlu> <20191011114851.GA8750@aaronlu> <20191012035503.GA113034@aaronlu> <20191014095725.GA78693@aaronlu> In-Reply-To: <20191014095725.GA78693@aaronlu> From: Vineeth Remanan Pillai Date: Mon, 21 Oct 2019 08:30:21 -0400 Message-ID: Subject: Re: [RFC PATCH v3 00/16] Core scheduling v3 To: Aaron Lu 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 , =?UTF-8?B?RnLDqWTDqXJpYyBXZWlzYmVja2Vy?= , Kees Cook , Greg Kerr , Phil Auld , Valentin Schneider , Mel Gorman , Pawan Gupta , Paolo Bonzini Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Oct 14, 2019 at 5:57 AM Aaron Lu wrote: > > 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(). Understood. I think this case is a special case where one runqueue is empty and hence the min_vruntime of the core should match the progressing vruntime of the active runqueue. If we use max as the core wide min_vruntime, I think we may hit starvation elsewhere. On quick example I can think of is during force idle. When a sibling is forced idle, and if a new task gets enqueued in the force idled runq, it would inherit the max vruntime and would starve until the other tasks in the forced idle sibling catches up. While this might be okay, we are deviating from the concept that all new tasks inherits the min_vruntime of the cpu(core in our case). I have not tested deeply to see if there are any assumptions which may fail if we use max. The modified patch actually takes care of syncing the min_vruntime across the siblings so that, core wide min_vruntime and per cpu min_vruntime always stays in sync. Thanks, Vineeth