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

Michael S. Tsirkin mst at mellanox.co.il
Sat May 7 22:23:42 PDT 2005


Quoting r. Libor Michalek <libor at topspin.com>:
> Subject: Re: [PATCH] sdp: replace mlock with get_user_pages
> 
> On Thu, May 05, 2005 at 02:01:58PM +0300, Michael S. Tsirkin wrote:
> > Hello, Libor!
> > The following patch replaces the mlock hack with call
> > to get_user_pages. Since the application could have forked
> > while an iocb is outstanding, when an iocb is done
> > I do get_user_pages for a second time and copy data if
> > the physical address has changed.
> > 
> > Thus, changing ulimit is no longer required to get aio
> > working, processes are also allowed to fork and to call mlock/munlock
> > on the buffer.
> > 
> > Tested by the ttcp.aio benchmark, and works fine for me.
> 
>   In the latest kernel what happens to a page that's held
> with a get_user_page reference on fork? Which is the only
> case left.

I dont think there's a change - the only other way to handle
this is to block fork until an iocb is complete.

> Since there is an iocv flag parameter it would
> be prefered to use a bit there instead of is_receive. Also,
> please leave spaces around '='.

I'll try to address these.

> Finally it would be nice
> if we could get rid of having to schedule a task to unlock
> the iocb in complete, I've noticed this having a negative
> effect on system CPU utilization on older kernels.
> 
> -Libor

Even we get around the fact that get user pages needs an mm semaphore,
its still nontrivial since set_page_dirty_lock might sleep.

MST

-- 
MST - Michael S. Tsirkin



More information about the general mailing list