From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754902AbcFIBUj (ORCPT ); Wed, 8 Jun 2016 21:20:39 -0400 Received: from mx1.redhat.com ([209.132.183.28]:54164 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751172AbcFIBUi (ORCPT ); Wed, 8 Jun 2016 21:20:38 -0400 Message-ID: <1465435233.16365.162.camel@redhat.com> Subject: Re: [PATCH v5 3/3] sched/cputime: Add steal time support to full dynticks CPU time accounting From: Rik van Riel To: Wanpeng Li Cc: "linux-kernel@vger.kernel.org" , kvm , Wanpeng Li , Ingo Molnar , "Peter Zijlstra (Intel)" , Thomas Gleixner , Frederic Weisbecker , Paolo Bonzini , Radim =?UTF-8?Q?Kr=C4=8Dm=C3=A1=C5=99?= Date: Wed, 08 Jun 2016 21:20:33 -0400 In-Reply-To: References: <1465355110-21714-1-git-send-email-wanpeng.li@hotmail.com> <1465355110-21714-3-git-send-email-wanpeng.li@hotmail.com> <1465412700.4639.10.camel@redhat.com> Content-Type: multipart/signed; micalg="pgp-sha256"; protocol="application/pgp-signature"; boundary="=-ae0MkTYDBXZ0/pm+7Rh4" Mime-Version: 1.0 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Thu, 09 Jun 2016 01:20:37 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --=-ae0MkTYDBXZ0/pm+7Rh4 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, 2016-06-09 at 07:57 +0800, Wanpeng Li wrote: > 2016-06-09 3:05 GMT+08:00 Rik van Riel : > >=20 > > On Wed, 2016-06-08 at 11:05 +0800, Wanpeng Li wrote: > > >=20 > > >=20 > > > @@ -681,12 +681,17 @@ static cputime_t vtime_delta(struct > > > task_struct > > > *tsk) > > > =C2=A0static cputime_t get_vtime_delta(struct task_struct *tsk) > > > =C2=A0{ > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0unsigned long now =3D READ_ONCE(j= iffies); > > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0unsigned long delta =3D now - tsk->vti= me_snap; > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0cputime_t delta_time, steal_time; > > >=20 > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0steal_time =3D > > > jiffies_to_cputime(steal_account_process_tick()); > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0delta_time =3D jiffies_to_cputime(now = - tsk->vtime_snap); > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0WARN_ON_ONCE(tsk->vtime_snap_when= ce =3D=3D VTIME_INACTIVE); > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0tsk->vtime_snap =3D now; > > >=20 > > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0return jiffies_to_cputime(delta); > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0if (steal_time < delta_time) > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0delta_time -=3D steal_time; > > > + > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0return delta_time; > > > =C2=A0} > > This isn't right. > >=20 > > If steal_time is equal to or larger than delta_time, > > get_vtime_delta needs to return 0, not delta_time. > >=20 > > Otherwise the same time will be counted twice. > Paolo also pointed out this yesterday, so his proposal looks good to > you, right? >=20 Yes it does. I can build the irqtime rework on top of your patches, taking irq and softirq time out of the vtime delta as well. With Paolo's proposal, no time will ever be accounted double, which is a good thing. --=20 All Rights Reversed. --=-ae0MkTYDBXZ0/pm+7Rh4 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEcBAABCAAGBQJXWMRiAAoJEM553pKExN6DVT4H/2okZQdS8rGHka32ETGGx/TP 55tzTQe5d3TmpJA0YnVUk4P3a9q+qM0T5DWahW2csCnxI7qF+tWwmIfD4qh2/hST 6OhXH8PuM/GMKpBu72POFaw6FpzPuGkyj4niO0N1VntLsQMz6cd1tKgcPsK1zSZW JNZF/0a86TutRd4ZNKLja/+uCIZgWjOm2zDYtStmPalH2Eb6AZcT5HgzVVRjH7kn utn34Et4bYbzARqc1J2O4O6HRoNZtfSncnoJJTntlzsx9/EC3crHV/E3mlcCExX2 j0CpvZ7I9Njr65oWMKdtkzDm4xPlxCk0xIdD3k7tuyNZkfpzyQPLja6AK/sFQeA= =ysow -----END PGP SIGNATURE----- --=-ae0MkTYDBXZ0/pm+7Rh4--