[ofa-general] ib_umem_get always wants write access

Roland Dreier rdreier at cisco.com
Wed Mar 21 11:23:35 PDT 2007


 > 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.

 - R.



More information about the general mailing list