lkml.org 
[lkml]   [2013]   [Oct]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH] perf, x86: Optimize intel_pmu_pebs_fixup_ip()
From
On Thu, Oct 17, 2013 at 9:30 AM, Peter Zijlstra <peterz@infradead.org> wrote:
>
> So avoid having to call copy_from_user_nmi() for every instruction.
> Since we already limit the max basic block size, we can easily
> pre-allocate a piece of memory to copy the entire thing into in one
> go.

copy_from_user_nmi() itself is all kinds of nasty.

Using __get_user_pages_fast() for a single page is quite expensive,
and mucks around with the page counts etc.

If copy_from_user_nmi() just did the (simple) page table walk by hand,
it could avoid *all* of that. No page count stuff - just have
interrupts disabled over not just the page walk, but the copy too - to
guarantee that no cross-CPU TLB flush can come in.

So instead of trying to improve __get_user_pages_fast() - which is
impossible because the interface fundamentally means that it has to
iterate over things and check page counts - you could simplify the
caller instead.

That is, if we really care any more. Maybe this "do the
copy_from_user_nmi() just once" is already good enough that nobody
much cares.

Linus


\
 
 \ /
  Last update: 2013-10-17 21:41    [W:0.115 / U:10.260 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site