From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751969AbcFUWdV (ORCPT ); Tue, 21 Jun 2016 18:33:21 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52875 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751519AbcFUWdU (ORCPT ); Tue, 21 Jun 2016 18:33:20 -0400 Message-ID: <1466548351.8637.10.camel@redhat.com> Subject: Re: [PATCH 5/5] irqtime: drop local_irq_save/restore from irqtime_account_irq From: Rik van Riel To: Peter Zijlstra Cc: linux-kernel@vger.kernel.org, mingo@kernel.org, pbonzini@redhat.com, fweisbec@gmail.com, wanpeng.li@hotmail.com, efault@gmx.de, tglx@linutronix.de, rkrcmar@redhat.com Date: Tue, 21 Jun 2016 18:32:31 -0400 In-Reply-To: <20160621222832.GU30909@twins.programming.kicks-ass.net> References: <1466093167-27653-1-git-send-email-riel@redhat.com> <1466093167-27653-6-git-send-email-riel@redhat.com> <20160621214934.GT30909@twins.programming.kicks-ass.net> <1466547814.8637.8.camel@redhat.com> <20160621222832.GU30909@twins.programming.kicks-ass.net> Content-Type: multipart/signed; micalg="pgp-sha256"; protocol="application/pgp-signature"; boundary="=-MJ2j/tYDZXTaLW91OH8n" Mime-Version: 1.0 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Tue, 21 Jun 2016 22:32:35 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --=-MJ2j/tYDZXTaLW91OH8n Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, 2016-06-22 at 00:28 +0200, Peter Zijlstra wrote: > On Tue, Jun 21, 2016 at 06:23:34PM -0400, Rik van Riel wrote: > >=C2=A0 > > > > + /* > > > > + =C2=A0* Softirq context may get interrupted by hardirq > > > > context, > > > > + =C2=A0* on the same CPU. At softirq entry time the amount > > > > of > > > > time > > > > + =C2=A0* spent in hardirq context is stored. At softirq exit > > > > time, > > > > + =C2=A0* the time spent in hardirq context during the > > > > softirq is > > > > + =C2=A0* subtracted. > > > > + =C2=A0*/ > > > > + prev_hardirq =3D __this_cpu_read(prev_hardirq_time); > > > > + prev_softirq_start =3D > > > > __this_cpu_read(softirq_start_time); > > > > + > > > > + if (irqtype =3D=3D HARDIRQ_OFFSET) { > > > > + delta =3D sched_clock_cpu(cpu) - > > > > __this_cpu_read(hardirq_start_time); > > > > + __this_cpu_add(hardirq_start_time, delta); > > > > + } else do { > > > > + u64 now =3D sched_clock_cpu(cpu); > > > > + hardirq_time =3D > > > > READ_ONCE(per_cpu(cpu_hardirq_time, > > > > cpu)); > > > Which makes this per_cpu(,cpu) usage somewhat curious. What's > > > wrong > > > with > > > __this_cpu_read() ? > > Is __this_cpu_read() as fast as per_cpu(,cpu) on all > > architectures? > Can't be slower. Don't get the argument though; you've used > __this_cpu > stuff all over the place, and here you use a per_cpu() for no reason. >=20 Good point. I will use __this_cpu_read here. > > > That whole thing is somewhat hard to read; but its far too late > > > for > > > me > > > to suggest anything more readable :/ > > I only had 2 1/2 hours of sleep last night, so I will not > > try to rewrite it now, but I will see if there is anything > > I can do to make it more readable tomorrow. > >=20 > > If you have any ideas before then, please let me know :) > Heh, step away from the computer ... ;-) No worries, I have booze with me. Everything will be just fine! ;) --=20 All Rights Reversed. --=-MJ2j/tYDZXTaLW91OH8n 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 iQEcBAABCAAGBQJXacB/AAoJEM553pKExN6DCvoIALsAcR1jGHP80XU4QUv8FZpy b+13VxFNY5/M+1IYiAnWOLuXPaKfG1IQecjq9oyW/b78AIe4XWawmIz3uGwQjGnM mKetmwnmIAoVTj5G1v7f89Kqd+QSbBWEOcI8ze8FM5vC/fg4N9jYJlMoUVHEI7Ek KLCb2/YlV+AsN13jAF6fFt11CApBLyaqwGj+zir+USzHU7pvbDHLrJbflX0j46w4 OCwdFSguMDMnQNpJom1kP7PmpDTWnxncT8RcXUCXpnGQhP4t5HzItffQtfCDE3F+ xfKhaffaklu9f/mBDtQHIR+bX7D4TaQwd55kmbCwqPccWxZ6xUL4o9ylGDndhV8= =cUvn -----END PGP SIGNATURE----- --=-MJ2j/tYDZXTaLW91OH8n--