RE: [rfc 2/2] x86, bts: use physically non-contiguous trace buffer

From: Metzger, Markus T
Date: Wed Apr 29 2009 - 05:14:48 EST


>-----Original Message-----
>From: Peter Zijlstra [mailto:a.p.zijlstra@xxxxxxxxx]
>Sent: Monday, April 27, 2009 12:54 PM
>To: Ingo Molnar
>Cc: Andrew Morton; Metzger, Markus T; markus.t.metzger@xxxxxxxxx; roland@xxxxxxxxxx;
>eranian@xxxxxxxxxxxxxx; oleg@xxxxxxxxxx; Villacis, Juan; ak@xxxxxxxxxxxxxxxxxx; linux-
>kernel@xxxxxxxxxxxxxxx; tglx@xxxxxxxxxxxxx; hpa@xxxxxxxxx
>Subject: Re: [rfc 2/2] x86, bts: use physically non-contiguous trace buffer
>
>On Fri, 2009-04-24 at 10:31 +0200, Ingo Molnar wrote:
>> * Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> wrote:
>>
>
>> > The patch looks like a regression to me. vmalloc memory is slower
>> > to allocate, slower to free, slower to access and can exhaust or
>> > fragment the vmalloc arena. Confused.
>>
>> Performance does not matter here (this is really a slowpath), but
>> fragmentation does matter, especially on 32-bit systems.
>>
>> I'd not uglify the code via vmap() - and vmap has the same
>> fundamental address space limitations on 32-bit as vmalloc().
>>
>> The existing kmalloc() is fine. We do larger than PAGE_SIZE
>> allocations elsewhere too (the kernel stack for example), and this
>> is a debug facility, so failing the allocation is not a big problem
>> even if it happens.
>
>Nobody has yet told what the typical size of these allocations are. If
>they're large enough to account in pages, one should arguable use the
>page allocator not kmalloc. Also, any >3 order allocation (>32kb) are
>very likely to fail. Having this ptrace interface work in the (unloaded)
>development environment but not in a (loaded) production environment
>will render it basically useless IMHO.

The size of these allocations is limited by the lockable memory ulimit
and debuggers typically need to divide this between multiple threads.

In practice, I would expect the buffers to be small. One page already
gives you ~170 entries and the most interesting part is the tail of
the trace, anyway.


>Having a regular high order allocation with vmalloc/vmap fallback is
>quite normal, esp. if one wants to promote the use of this facility as
>usable.
>
>So, no, I very strongly disagree that the existing kmalloc is fine.

I could add the vmalloc fallback. Is there already some function that
tries kmalloc and falls back to vmalloc which I should use?

thanks,
markus.
---------------------------------------------------------------------
Intel GmbH
Dornacher Strasse 1
85622 Feldkirchen/Muenchen Germany
Sitz der Gesellschaft: Feldkirchen bei Muenchen
Geschaeftsfuehrer: Douglas Lusk, Peter Gleissner, Hannes Schwaderer
Registergericht: Muenchen HRB 47456 Ust.-IdNr.
VAT Registration No.: DE129385895
Citibank Frankfurt (BLZ 502 109 00) 600119052

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/