Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754799AbbLAPrT (ORCPT ); Tue, 1 Dec 2015 10:47:19 -0500 Received: from mail.fireflyinternet.com ([87.106.93.118]:61568 "EHLO fireflyinternet.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752619AbbLAPrR (ORCPT ); Tue, 1 Dec 2015 10:47:17 -0500 X-Default-Received-SPF: pass (skip=forwardok (res=PASS)) x-ip-name=78.156.65.138; Date: Tue, 1 Dec 2015 15:46:55 +0000 From: Chris Wilson To: Daniel Vetter Cc: LKML , DRI Development , Intel Graphics Development , Thomas Gleixner , Arjan van de Ven , Andrew Morton , Daniel Vetter Subject: Re: [PATCH 1/2] kernel/latencytop: Add non-scheduler interface for latency reporting Message-ID: <20151201154655.GD26256@nuc-i3427.alporthouse.com> Mail-Followup-To: Chris Wilson , Daniel Vetter , LKML , DRI Development , Intel Graphics Development , Thomas Gleixner , Arjan van de Ven , Andrew Morton , Daniel Vetter References: <1448983768-22324-1-git-send-email-daniel.vetter@ffwll.ch> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1448983768-22324-1-git-send-email-daniel.vetter@ffwll.ch> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2448 Lines: 65 On Tue, Dec 01, 2015 at 04:29:27PM +0100, Daniel Vetter wrote: > Some sources of significant amounts of latency aren't simple sleeps > but instead busy-loops or a series of hundreds of small sleeps simply > because the hardware can't do better. Unfortunately latencytop doesn't > register these and so they slip under the radar. Hence expose a > simplified interface to report additional latencies and export the > underlying function so that modules can use this. > > The example I have in mind are edid reads. The drm subsystem exposes > both interfaces to do full probes and to just get at the cached state > from the last probe and often userspace developers don't know about > the difference and incur unecessary big latencies. And usually the i2c > transfer is done with busy-looping or if there is a hw engine it might > only be able to transfer a few bytes per sleep/irq cycle. And edid > reads take at least 12ms and with crappy hw can easily be a few > hundred ms. > > Cc: Thomas Gleixner > Cc: Arjan van de Ven > Cc: Andrew Morton > Signed-off-by: Daniel Vetter > --- > include/linux/latencytop.h | 15 +++++++++++++++ > kernel/latencytop.c | 2 ++ > 2 files changed, 17 insertions(+) > > diff --git a/include/linux/latencytop.h b/include/linux/latencytop.h > index e23121f9d82a..46b69bc35f02 100644 > --- a/include/linux/latencytop.h > +++ b/include/linux/latencytop.h > @@ -10,6 +10,9 @@ > #define _INCLUDE_GUARD_LATENCYTOP_H_ > > #include > + > +#include > + > struct task_struct; > > #ifdef CONFIG_LATENCYTOP > @@ -35,6 +38,13 @@ account_scheduler_latency(struct task_struct *task, int usecs, int inter) > __account_scheduler_latency(task, usecs, inter); > } > > +static inline void > +account_latency(int usecs) > +{ > + if (unlikely(latencytop_enabled)) > + __account_scheduler_latency(current, usecs, 0); Just account_scheduler_latency(current, usecs, 0); > +} And then that can be used for both ifdef paths, i.e. move account_latency() to after the #endif. -Chris -- Chris Wilson, Intel Open Source Technology Centre -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/