Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp974784imm; Fri, 28 Sep 2018 09:45:16 -0700 (PDT) X-Google-Smtp-Source: ACcGV604bJZXDDtTdisSKyFs412f6GXO2pp5b47HKsCeaa+9Ugfva29YbRWihkk3Dk9mhJqmPYa6 X-Received: by 2002:a62:6283:: with SMTP id w125-v6mr17638741pfb.108.1538153116883; Fri, 28 Sep 2018 09:45:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538153116; cv=none; d=google.com; s=arc-20160816; b=AmYjmf8OU8ZTSWVMPfPbAMxjw4rEUPaokjIcApGFbAY5ewZ9Be7k/w0wzeokMNMLRz wVy4BOYLqV3N7cLZ+2ypFimf7BEsUCJLix39JVTP/KcBTvPoom2EmBb3NvS7W0GVb/3b RVuhOrqlgduvEK/xPqEvtiVprdZhMpO8AtEUQ1H35gSb6ag9BOkfuRtbD1ATYbKG7swc mkSeMEByPxEwLs3rR8nreoVLkEb4UUc0btCjJdXE/X2VzFv4wqnT79T0H7aYosNojo/J S6b1X6iQZfPr9asyz20XXTgvQ9ala+7Mb55Z8xTwEKsAGTuRVWMJ3FloOR7KNBpvhO2s yeRQ== 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 :references:in-reply-to:mime-version:dkim-signature; bh=8Cb/DQIaYzta2SyDUga23E6hAgj/e33tq3DL8c560fk=; b=hOlNKTlgzvFe5m/RcINYRlq3uHQIICsqX6rBgjXCoERi13A20digZDPav8mVZ4jAkx 2j+iFPK2OzXxqgdt/5/2p0IMOaedzG1yfhcgy9v0AIHSRcpHuW62/WyogM7K8jCj/Mpu TkApq48WzC9lRDd+IVajSd740ZsuPZZWpMoq1HfMdXdodR5W4S/blQOKeCcTp07TuSqZ 7aEiV11a694uY8OTw+1vWIVtx9sscWNEKAdC241X+YTAQl0IVzjxTtHA50EMmv8KoJ3m 5aVpwE1G/Q2zUqdId5dXRfMpUltdY59bOwCvJUPaJx1vhHVFStqZbSdeZy4rXEW55uHo gE9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=mNXybYl1; 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=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n25-v6si5195164pfh.207.2018.09.28.09.44.40; Fri, 28 Sep 2018 09:45:16 -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=@google.com header.s=20161025 header.b=mNXybYl1; 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=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729342AbeI1XHu (ORCPT + 99 others); Fri, 28 Sep 2018 19:07:50 -0400 Received: from mail-qk1-f196.google.com ([209.85.222.196]:38542 "EHLO mail-qk1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728643AbeI1XHt (ORCPT ); Fri, 28 Sep 2018 19:07:49 -0400 Received: by mail-qk1-f196.google.com with SMTP id 204-v6so3578492qkd.5 for ; Fri, 28 Sep 2018 09:43:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=8Cb/DQIaYzta2SyDUga23E6hAgj/e33tq3DL8c560fk=; b=mNXybYl1ZTDvd7WQdLglwD/n7PHY2OVGDpEq8TF8RQB3BgZM64uOvej3ancAGr/soE DM4+KOUhVdA+nnSe3B5SZx8oGbxxnSfUxORbLtW/RDbT0oLa/ocVwuYZx+Qo9h+VwOzr TFmCbDcT9hBq61inte143kOf90a23vmFAZziappv6b23VURRLN6TvWtQVXAnp7Nz/ajy 1iPqhGvXVgF2zNqGHaup3/F9L847bP85vTGTDqjoBFZ6+p4zykOpnh6KtaaGHZ3iwZsm VLBpoGAzvNLxSR9zUIbslRXVffnQ1fhIFUbZhXmAHgiF3nJrdyULceKgglMPVH8NcgUu XDYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=8Cb/DQIaYzta2SyDUga23E6hAgj/e33tq3DL8c560fk=; b=PIWrFtQLiTLGQ8NvttqBjdzQa4AbhDYrDe7DVKe3C6eKj+peA+C9NI47uEOnyU6raU IextwCIbV0s/wBKczq7heAyEH6Wn3teu/SK9KRlMiVOUoP+pQtJHU7+fCGHVvoidTTnl SjIc5xzULVhL+5cnJWsF0cwiG01JNgkhKmt7Em7tiFzkK78m5HDih6RpZuD5jrMAKYm9 +XbK6jR7ETo7yfKQYrcxQU4SecFc3XOumvLJkyrgvlR6Xf8sGDcC5sqRhnbO3NWq1g7J vEo7Gobs9ytCkkJcfhrcXJdnk6dYeldd13fNKvAKFq84H6BG3BzBttpOFUxYk0hgd1nN mcJw== X-Gm-Message-State: ABuFfoi4Vc1AImUVd7CP3IdpbClkOPDmH5BNWM7Nx89hu/wQwGEA3pKX +NvaSDkcXggeQsd+1uFj3k9U17PoNZ/LLZ7QkFHEFfTFr50= X-Received: by 2002:a37:c603:: with SMTP id b3-v6mr12409669qkj.176.1538152993284; Fri, 28 Sep 2018 09:43:13 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:ac8:2abb:0:0:0:0:0 with HTTP; Fri, 28 Sep 2018 09:43:12 -0700 (PDT) In-Reply-To: References: <20180817182728.76129-1-smuckle@google.com> <20180824093227.GN24124@hirez.programming.kicks-ass.net> <20180824094742.GJ24142@hirez.programming.kicks-ass.net> <20180827111458.GB24124@hirez.programming.kicks-ass.net> <2ed346fa-dbe8-4928-928b-a34338b2d8c9@arm.com> <62134bba-b6bd-ba16-a49b-e4887c326559@arm.com> From: Joel Fernandes Date: Fri, 28 Sep 2018 09:43:12 -0700 Message-ID: Subject: Re: [PATCH] sched/fair: vruntime should normalize when switching from fair To: Wanpeng Li Cc: Dietmar Eggemann , Peter Zijlstra , Steve Muckle , Miguel de Dios , Ingo Molnar , LKML , "Cc: Android Kernel" , Todd Kjos , Paul Turner , Quentin Perret , Patrick Bellasi , Chris Redpath , Morten Rasmussen , John Dias , Wanpeng Li 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 Wed, Sep 26, 2018 at 6:19 PM, Wanpeng Li wrote: > On Thu, 27 Sep 2018 at 06:38, Dietmar Eggemann wrote: >> >> Hi, >> >> On 09/26/2018 11:50 AM, Wanpeng Li wrote: >> > Hi Dietmar, >> > On Tue, 28 Aug 2018 at 22:55, Dietmar Eggemann wrote: >> >> >> >> On 08/27/2018 12:14 PM, Peter Zijlstra wrote: >> >>> On Fri, Aug 24, 2018 at 02:24:48PM -0700, Steve Muckle wrote: >> >>>> On 08/24/2018 02:47 AM, Peter Zijlstra wrote: >> >>>>>>> On 08/17/2018 11:27 AM, Steve Muckle wrote: >> >> [...] >> >> >>>>>>>> - later, when the prio is deboosted and the task is moved back >> >>>>>>>> to the fair class, the fair rq's min_vruntime is added to >> >>>>>>>> the task's vruntime, even though it wasn't subtracted earlier. >> > >> > Could you point out when the fair rq's min_vruntime is added to the >> > task's vruntime in your *later* scenario? attach_task_cfs_rq will not >> > do that the same reason as detach_task_cfs_rq. fair task's >> > sched_remote_wakeup is false which results in vruntime will not be >> > renormalized in enqueue_entity. >> >> The cfs_rq->min_vruntime is still added to the se->vruntime in >> enqueue_task_fair(). > > I understand what your patch done, > > On your CPU4: > scheduler_ipi() > -> sched_ttwu_pending() > -> ttwu_do_activate() => p->sched_remote_wakeup should be > false, so ENQUEUE_WAKEUP is set, ENQUEUE_MIGRATED is not > -> ttwu_activate() > -> activate_task() > -> enqueue_task() > -> enqueue_task_fair() > -> enqueue_entity() > bool renorm = !(flags & > ENQUEUE_WAKEUP) || (flags & ENQUEUE_MIGRATE) > so renorm is false in enqueue_entity(), why you mentioned that the > cfs_rq->min_vruntime is still added to the se->vruntime in > enqueue_task_fair()? If I understand John's original patch correctly, the additional vruntime is added when the class of the waking task is changed during priority deboost so that path is different from the one you listed above? Perhaps you should be looking at rt_mutex_setprio? - Joel