From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932647AbcFGMeq (ORCPT ); Tue, 7 Jun 2016 08:34:46 -0400 Received: from mx1.redhat.com ([209.132.183.28]:54059 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932514AbcFGMep (ORCPT ); Tue, 7 Jun 2016 08:34:45 -0400 Subject: Re: [PATCH v4 3/3] sched/cputime: Add steal time support to full dynticks CPU time accounting To: Wanpeng Li References: <1465661590-4732-1-git-send-email-wanpeng.li@hotmail.com> <56bdc61d-fed4-76bd-4e5f-5172ad0e20fa@redhat.com> Cc: Wanpeng Li , "linux-kernel@vger.kernel.org" , "kvm@vger.kernel.org" , Ingo Molnar , "Peter Zijlstra (Intel)" , Rik van Riel , Thomas Gleixner , Frederic Weisbecker , =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= From: Paolo Bonzini Message-ID: <7b182c01-5d17-d73a-1906-3f7155b4236c@redhat.com> Date: Tue, 7 Jun 2016 14:34:36 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.1.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Tue, 07 Jun 2016 12:34:44 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 07/06/2016 14:15, Wanpeng Li wrote: >> > >> > You're adding almost the same code to two callers of get_vtime_delta out >> > of three. I don't know the vtime accounting code very well, but why >> > doesn't the same apply to account_idle_time? > St stuff is accounted when vCPUs(tasks on host) are enqueued in rb > trees of pCPUs, which means that they are ready to run until they > finially reach CPUs. However, when vCPUs are idle, they will be > dequeued from rb trees and the time will be not accounted as st. Why not? If idle=poll, for example, any time the guest is suspended (and thus cannot poll) does count as stolen time. In addition, you are going to account the stolen time anyway sooner or later, and then it will be accounted wrong (subtracted to either user or system time). I really believe you should do the change directly in get_vtime_delta. Paolo >> > If it does, you should instead change get_vtime_delta to process steal >> > time and subtract it from the result. >> > >> > Secondarily, when can it happen that steal_time > delta_time? > Rik explanation it when he reply to v1. > http://www.gossamer-threads.com/lists/linux/kernel/2441175?do=post_view_threaded#2441175