Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1004164imm; Fri, 28 Sep 2018 10:13:40 -0700 (PDT) X-Google-Smtp-Source: ACcGV62/ZvrZqPK9VXoZkk/xFiTOfKZDH6Q3l2sum6YbyShUsvDk/dXeQghYjDE6ILnAtNfx29Cl X-Received: by 2002:a62:2fc1:: with SMTP id v184-v6mr5394075pfv.115.1538154819966; Fri, 28 Sep 2018 10:13:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538154819; cv=none; d=google.com; s=arc-20160816; b=N5wPRoA8H2KwWdidQxewoXR7qpuCP03XiCxU0oAb8mzDZMZSqDqr2EM1svrZKc7rfK Eq/lR4oacEM2pfpPKwwIM3SRcXGTG6SI1CdFdAy6KnSXPwEtJVexN9e+K8EHbQwlPL3r d1CkAQEiiubQ4FCiPkEc6knezC2qWSoUvG5r7w2BNnMnCii0oyAGXBSOILdSzsNFGX9a CUXBCoeuPQAA4jjgY9EE9qGm2qB0UZnO9ikVASygs/CE2QtQRhFRqCaOguo6oVmxd8jI aiknQhFSanZsl3yT+z4TppsMarw8ALcxqMjtVBCPgSj1jmS3FgBF9mNuWQleOwPIxfNq +PbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=oJDqi7Q067geBq+jHqDPeei+HEF48hffG/Z0exnSP08=; b=iZmivNqbx3uCp2BLKgw//hIQk/OioZXLS2J0hdSG8bDbLhR2lwGyywhWtSv8C93eHz kcjCyJqagAuGGxQPIeTNuWMILCojFnZ1pLZvzjr9kxlzRTwPEVOeEwxvyrYE6ChuXUR/ Q7feqnLkPwBRBRjiVsM0n9atMKWIJmPzQMTW2PPwqVqpXA5pxk5v/sHr2MpGPfPy+rPH hHzEFa1A21PLdIWQ/jpoOekM0GLZWMysrJuwwxaf5+ywWv+GnyX/mawbjNRWNpivulZ+ Ws0jUXISYPJFTH0JTfK+kaDfNWHHmS2IeqF5pH7MWeZ17YUvDujmvEsrWFIDXFcfIBEm g6Hg== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g10-v6si4878230plt.212.2018.09.28.10.13.24; Fri, 28 Sep 2018 10:13:39 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728946AbeI1Xgo (ORCPT + 99 others); Fri, 28 Sep 2018 19:36:44 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:53738 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726473AbeI1Xgn (ORCPT ); Fri, 28 Sep 2018 19:36:43 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 4482018A; Fri, 28 Sep 2018 10:12:01 -0700 (PDT) Received: from [0.0.0.0] (e107985-lin.emea.arm.com [10.4.12.239]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 2EDD13F5BD; Fri, 28 Sep 2018 10:11:53 -0700 (PDT) Subject: Re: [PATCH] sched/fair: vruntime should normalize when switching from fair To: Wanpeng Li Cc: Peter Zijlstra , Steve Muckle , Miguel de Dios , Ingo Molnar , LKML , kernel-team@android.com, Todd Kjos , Paul Turner , quentin.perret@arm.com, Patrick Bellasi , Chris.Redpath@arm.com, Morten Rasmussen , John Dias , Wanpeng Li 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: Dietmar Eggemann Message-ID: Date: Fri, 28 Sep 2018 19:11:50 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 09/28/2018 02:43 AM, Wanpeng Li wrote: > On Thu, 27 Sep 2018 at 21:23, Dietmar Eggemann wrote: >> >> On 09/27/2018 03:19 AM, 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, >> >> It's not my patch ;-) I just helped to find out under which >> circumstances this issue can happen. >> >>> 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()? >> >> Maybe this is a misunderstanding on my side but didn't you asked me to >> '... Could you point out when the fair rq's min_vruntime is added to the >> task's vruntime in your *later* scenario? ...' > > Yeah, if the calltrace above and my analysis is correct, then the fair > rq's min_vruntime will not be added to the task's vruntime in your > *later* scenario, which means that your patch is not necessary. Ah, ok, both, the ENQUEUE_WAKEUP and the ENQUEUE_MIGRATED are not set in the enqueue_entity() call so renorm is 1 (flags is 0xe).