Subject: Re: [RFC PATCH v2 03/19] vbus: add connection-client helper infrastructure

From: Gregory Haskins <[email-masked]>
Date: Thu, 04 Jun 2009 14:30:59 -0400

Avi Kivity wrote:
> Gregory Haskins wrote:
>
>   
>>> BTW, why did you decide to use get_user_pages?
>>> Would switch_mm + copy_to_user work as well
>>> avoiding page walk if all pages are present?
>>>       
>>
>> Well, basic c_t_u() won't work because its likely not "current" if you
>> are updating the ring from some other task, but I think you have already
>> figured that out based on the switch_mm suggestion.  The simple truth is
>> I was not familiar with switch_mm at the time I wrote this (nor am I
>> now).  If this is a superior method that allows you to acquire
>> c_t_u(some_other_ctx) like behavior, I see no problem in changing.  I
>> will look into this, and thanks for the suggestion!
>>   
>
> copy_to_user() is significantly faster than get_user_pages() + kmap()
> + memcmp() (or their variants).
>

Oh, I don't doubt that (in fact, I was pretty sure that was the case
based on some of the optimizations I could see in studying the c_t_u()
path).  I just didn't realize there were other ways to do it if its a
non "current" task. ;)

I guess the enigma for me right now is what cost does switch_mm have? 
(Thats not a slam against the suggested approach...I really do not know
and am curious).

As an aside, note that we seem to be reviewing v2, where v3 is really
the last set I pushed.  I think this patch is more or less the same
across both iterations, but FYI that I would recommend looking at v3
instead.

-Greg