[ofa-general] ib_umem_get always wants write access
Pete Wyckoff
pw at osc.edu
Fri Mar 23 08:11:27 PDT 2007
rdreier at cisco.com wrote on Wed, 21 Mar 2007 11:23 -0700:
> > I've wondered about this for a while. In ib_umem_get, there is a
> > call to get_user_pages that does the work of virtual to physical
> > translation and increasing the ref counts. It is always invoked
> > with write == 1, even if cmd.access_flags == 0 (read only
> > registration).
> >
> > This is fine for anonymous private memory, or writeable shared
> > memory. But consider pinning a read-only section of memory, such as
> > shared read-only data or text segment, or a file mapping of a file
> > that was opened O_RDONLY. Having write == 1 there forces a full
> > copy of all these pages.
> >
> > The force argument is explicitly set to 1 only when access_flags
> > does not specify write access, giving gup permission to do the
> > copy-on-write, essentially. That seems correct, but always setting
> > write to 1 has me confused.
> >
> > Is there some IB semantic reason for forcing the registered pages to
> > be writable?
>
> I'm having a hard time remembering the exact reasoning, but the basic
> idea is that we need to allow read-only memory to be registered but we
> also need to force allocated but not touched memory to be faulted in.
Thanks, I'll try to setup a scenario where read-only memory is not
present, then gup with write = 0 and see if it does not do the
faulting properly. It's not clear to me now.
The performance degradation of COW-ing read-only pages is noticable.
-- Pete
More information about the general
mailing list