On Thu, Apr 19, 2018 at 04:15:02PM -0400, Jerome Glisse wrote: > Well like you pointed out what i really want is a 1:1 structure linking > a device struct an a mm_struct. Given that this need to be cleanup when > mm goes away hence tying this to mmu_notifier sounds like a better idea. > > I am thinking of adding a hashtable to mmu_notifier_mm using file id for > hash as this should be a good hash value for common cases. I only expect > few drivers to need that (GPU drivers, RDMA). Today GPU drivers do have > a hashtable inside their driver and they has on the mm struct pointer, > i believe hash mmu_notifier_mm using file id will be better. What _is_ "file id"? If you are talking about file descriptors, you can very well have several for the same opened file. Moreover, you can bloody well have it opened, then dup'ed, then original descriptor closed and reused by another open...