From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756918AbcBISNV (ORCPT ); Tue, 9 Feb 2016 13:13:21 -0500 Received: from mx1.redhat.com ([209.132.183.28]:43434 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756694AbcBISNT (ORCPT ); Tue, 9 Feb 2016 13:13:19 -0500 Message-ID: <1455041586.15821.4.camel@redhat.com> Subject: Re: [PATCH 4/4] sched,time: only call account_{user,sys,guest,idle}_time once a jiffy From: Rik van Riel To: Frederic Weisbecker Cc: linux-kernel@vger.kernel.org, tglx@linutronix.de, mingo@kernel.org, luto@amacapital.net, peterz@infradead.org, clark@redhat.com, eric.dumazet@gmail.com Date: Tue, 09 Feb 2016 13:13:06 -0500 In-Reply-To: <20160209171139.GA7535@lerouge> References: <1454433586-3234-1-git-send-email-riel@redhat.com> <1454433586-3234-5-git-send-email-riel@redhat.com> <20160209171139.GA7535@lerouge> Content-Type: multipart/signed; micalg="pgp-sha1"; protocol="application/pgp-signature"; boundary="=-pJlrRFssE3VQpC0NakEZ" Mime-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --=-pJlrRFssE3VQpC0NakEZ Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, 2016-02-09 at 18:11 +0100, Frederic Weisbecker wrote: > On Tue, Feb 02, 2016 at 12:19:46PM -0500, riel@redhat.com wrote: > > From: Rik van Riel > >=20 > > After removing __acct_update_integrals from the profile, > > native_sched_clock remains as the top CPU user. This can be > > reduced by only calling account_{user,sys,guest,idle}_time > > once per jiffy for long running tasks on nohz_full CPUs. > >=20 > > This will reduce timing accuracy on nohz_full CPUs to jiffy > > based sampling, just like on normal CPUs. >=C2=A0 > Now after this patch, the scenario is rather different. We are > accounting the > real time spent in a slice with a similar probablity. > This becomes: T_slice * P(T_slice*HZ). >=20 > So it seems it could result into logarithmic accounting: timeslices > of 1 second > will be accounted right whereas repeating tiny timeslices may result > in much lower > values than expected. You are right that this code does not handle short timeslices well. However, I believe it does not have to, because the scheduler already takes care of that. At context switch time, the scheduler will call vtime_common_task_switch, which calls arch_vtime_task_switch, which handles precise time accounting at task switch time. The call chain is like this: arch_vtime_task_switch vtime_common_task_switch vtime_task_switch finish_task_switch context_switch __schedule As you can see, the time accounting for shorter running tasks is already handled by other code, which means my patch should be ok. --=C2=A0 All rights reversed --=-pJlrRFssE3VQpC0NakEZ 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 v1 iQEcBAABAgAGBQJWuiwyAAoJEM553pKExN6D8oIH/1/m0BUXyqX9MckUrNKHegwO HVXuFKt/6Zx0k29UbuyphOxXJpAHHIhQ5X6kVtzYpv2B6oc35KgssNcXBqjLdUKo y/9XGRB25+OSOU16HcCLv2N5dpawSm6MCWxY7QCrBo/Exkhj4Gq2eOCN/3/0HgYv OD/2IItCQ452YbQ7WOtAHRrqwFYTZWzHK997Ww6DSy8sI3jiwTN64tXwJR4mF5af Fq9qc/ymp7GlzEoc7C29Qx9VIBS4dmwaTQqazEjNh1aKR4vKntpKCy+59Sj+9hNn XY7r89Luy3Pd9csDanlNjG3rBPpVvL3W++AF7G5btxEoLp6m/asFsqQXgT0RE+o= =bn9g -----END PGP SIGNATURE----- --=-pJlrRFssE3VQpC0NakEZ--