lkml.org 
[lkml]   [2022]   [Mar]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH] KVM: x86/mmu: Speed up slot_rmap_walk_next for sparsely populated rmaps
From
On 3/26/22 01:31, Vipin Sharma wrote:
>>> -static void slot_rmap_walk_next(struct slot_rmap_walk_iterator *iterator)
>>> +static noinline void
>>
>> What is the reason to add noinline?
>
> My understanding is that since this method is called from
> __always_inline methods, noinline will avoid gcc inlining the
> slot_rmap_walk_next in those functions and generate smaller code.
>

Iterators are written in such a way that it's way more beneficial to
inline them. After inlining, compilers replace the aggregates (in this
case, struct slot_rmap_walk_iterator) with one variable per field and
that in turn enables a lot of optimizations, so the iterators should
actually be always_inline if anything.

For the same reason I'd guess the effect on the generated code should be
small (next time please include the output of "size mmu.o"), but should
still be there. I'll do a quick check of the generated code and apply
the patch.

Paolo

\
 
 \ /
  Last update: 2022-03-27 12:42    [W:0.085 / U:0.160 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site