[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aHFnppb8xUGyezsK@krava>
Date: Fri, 11 Jul 2025 21:36:06 +0200
From: Jiri Olsa <olsajiri@...il.com>
To: Oleg Nesterov <oleg@...hat.com>
Cc: Peter Zijlstra <peterz@...radead.org>,
Andrii Nakryiko <andrii@...nel.org>, bpf@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-trace-kernel@...r.kernel.org,
x86@...nel.org, Song Liu <songliubraving@...com>,
Yonghong Song <yhs@...com>,
John Fastabend <john.fastabend@...il.com>,
Hao Luo <haoluo@...gle.com>, Steven Rostedt <rostedt@...dmis.org>,
Masami Hiramatsu <mhiramat@...nel.org>,
Alan Maguire <alan.maguire@...cle.com>,
David Laight <David.Laight@...lab.com>,
Thomas Weißschuh <thomas@...ch.de>,
Ingo Molnar <mingo@...nel.org>
Subject: Re: [PATCHv5 perf/core 08/22] uprobes/x86: Add mapping for optimized
uprobe trampolines
On Fri, Jul 11, 2025 at 07:46:32PM +0200, Oleg Nesterov wrote:
> 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,
correct, just the find_nearest_trampoline function
>
> Acked-by: Oleg Nesterov <oleg@...hat.com>
>
thanks,
jirka
Powered by blists - more mailing lists