On Tue, Mar 19, 2019 at 12:35:34AM +0200, Gal Pressman wrote: > On 14-Mar-19 17:49, Jason Gunthorpe wrote:> Every file offset 'key/cookie' has > zero in the lower PAGE_SHIFT > > bits, as mmap only works on page aligned offsets. > > > > The xarray key should be the page number to access - converted from > > the offset by stripping the lower PAGE_SHIFT bits (done by vm_pgoff > > already) and masking the upper flag bit> > > So with the 64 bit offset argument you only have 52 bits to to work > > with. > > - 12 are zero for PAGE_SHIFT > > - 32 are the page number for the xarray key > > - N are padding > > - N are the flags at a fixed location in the 64 bit offset> > > Userspace rdma-core can always use a 64 bit file offset for mmap. > > > > Makes sense. > >> I'll take a look into changing this into an xarray. > >> What did you mean by a cyclic allocating xarray? We can't reuse the keys as the > >> entries should be valid until application exit. > > > > Use xa_alloc_cyclic > > Thanks. It might not be a good idea though if you need a variable size of object - although xarray has range support exactly for this, I think Matt is unhappy with it. Best would be if you could just allocate your maximum (ie shift more bits down) Jason