On 07/11, Jiri Olsa wrote: > > +static unsigned long find_nearest_trampoline(unsigned long vaddr) > +{ > + struct vm_unmapped_area_info info = { > + .length = PAGE_SIZE, > + .align_mask = ~PAGE_MASK, > + }; > + unsigned long low_limit, high_limit; > + unsigned long low_tramp, high_tramp; > + unsigned long call_end = vaddr + 5; > + > + if (check_add_overflow(call_end, INT_MIN, &low_limit)) > + low_limit = PAGE_SIZE; > + > + high_limit = call_end + INT_MAX; > + > + /* Search up from the caller address. */ > + info.low_limit = call_end; > + info.high_limit = min(high_limit, TASK_SIZE); > + high_tramp = vm_unmapped_area(&info); > + > + /* Search down from the caller address. */ > + info.low_limit = max(low_limit, PAGE_SIZE); > + info.high_limit = call_end; > + info.flags = VM_UNMAPPED_AREA_TOPDOWN; > + low_tramp = vm_unmapped_area(&info); > + > + if (IS_ERR_VALUE(high_tramp) && IS_ERR_VALUE(low_tramp)) > + return -ENOMEM; > + if (IS_ERR_VALUE(high_tramp)) > + return low_tramp; > + if (IS_ERR_VALUE(low_tramp)) > + return high_tramp; > + > + /* Return address that's closest to the caller address. */ > + if (call_end - low_tramp < high_tramp - call_end) > + return low_tramp; > + return high_tramp; > +}
IIUC, nothing else has changed since I've acked the previous version? Then my ack still stands, Acked-by: Oleg Nesterov <o...@redhat.com>