[openib-general] Re: [PATCH] sdp: replace mlock with get_user_pages

Michael S. Tsirkin mst at mellanox.co.il
Sat Jul 23 13:51:03 PDT 2005


Quoting r. Libor Michalek <limichal at cisco.com>:
> Subject: Re: [PATCH] sdp: replace mlock with get_user_pages
> 
> On Thu, Jul 21, 2005 at 10:51:54AM +0300, Michael S. Tsirkin wrote:
> > Hello, Libor!
> > Here's a patch updated against the latest bits.
> > I'd like it to get merged, if possible.
> > 
> > The existing code play with VMA's is the #1 source of sdp problems for me.
> > The patch below works with no problems for me, so far.
> > 
> > Please comment.
> 
> Michael,
> 
>   Looking at sdp_iocb_unlock() I see that you attempt to perform the
> get_user_pages() for the full buffer before checking to see if the
> pages need copying, but if that fails you perform it a page at a time
> iterating through the list. Are you seeing this on a regular basis,
> that the full get fails, but then the iteration over the list works?
> Do you know what's causing this to happen, and whay the second iteration
> fixes it?
> 
> Thanks.
> 
> -Libor
> 

No, this is merely because some pages in the range may have been
unmapped from the process altogether, or permission may have been
changed with mprotect.
I'm not sure what is the best thing to do here, but since its
actually simple, and since I needed to handle the case of a failing kmalloc
anyway, I try them one by one to find out which pages are still OK,
and copy the data there.

I dont know whether some real applications actually do this.

MST

-- 
MST



More information about the general mailing list