On Thu, Aug 28, 2025 at 5:43 AM Jason Gunthorpe <jgg@xxxxxxxxxx> wrote: > > On Wed, Aug 27, 2025 at 05:03:55PM +0200, Pratyush Yadav wrote: > > > I think we need something a luo_xarray data structure that users like > > memfd (and later hugetlb and guest_memfd and maybe others) can build to > > make serialization easier. It will cover both contiguous arrays and > > arrays with some holes in them. > > I'm not sure xarray is the right way to go, it is very complex data > structure and building a kho variation of it seems like it is a huge > amount of work. > > I'd stick with simple kvalloc type approaches until we really run into > trouble. > > You can always map a sparse xarray into a kvalloc linear list by > including the xarray index in each entry. Each entry will be 16 byte, 8 for index and 8 for XAvalue, right? > Especially for memfd where we don't actually expect any sparsity in > real uses cases there is no reason to invest a huge effort to optimize > for it.. Ack. > > > As I explained above, the versioning is already there. Beyond that, why > > do you think a raw C struct is better than FDT? It is just another way > > of expressing the same information. FDT is a bit more cumbersome to > > write and read, but comes at the benefit of more introspect-ability. > > Doesn't have the size limitations, is easier to work list, runs > faster. Yes, especially when you have a large array. Chris