On Thu, 2024-05-02 at 09:46 -0300, Jason Gunthorpe wrote: > On Thu, May 02, 2024 at 11:11:04AM +0200, Thomas Hellström wrote: > > > It's true the cpu vma lookup is a remnant from amdkfd. The idea > > here is > > to replace that with fixed prefaulting ranges of tunable size. So > > far, > > as you mention, the prefaulting range has been determined by the > > CPU > > vma size. Given previous feedback, this is going to change. > > Perhaps limiting prefault to a VMA barrier is a reasonable thing to > do, but the implementation should be pushed into hmm_range_fault and > not open coded in the driver. > > > Still the prefaulting range needs to be restricted to avoid -EFAULT > > failures in hmm_range_fault(). That can ofc be done by calling it > > without HMM_PFN_REQ_FAULT for the range and interpret the returned > > pnfs. > > Yes, this is exactly what that feature is for, you mark your prefetch > differently from the fault critical page(s). > > > There is a performance concern of this approach as compared to > > peeking at the CPU vmas directly, since hmm_range_fault() would > > need to > > be called twice. Any guidelines ideas here? > > If there is something wrong with hmm_range_fault() then please fix > it. I'm not sure why you'd call it twice, the HMM_PFN_REQ_FAULT is > per > PFN? Ah, yes you're right. I somehow thought it was per range. Makes sense now. Thanks, Thomas > > Jason