Re: [PATCH 1/4] riscv: entry: Convert ret_from_fork() to C

From: Maciej W. Rozycki
Date: Mon Jan 27 2025 - 15:28:00 EST


On Sun, 26 Jan 2025, Charlie Jenkins wrote:

> > Wouldn't it make sense to save a jump here and make it a tail call, i.e.:
> >
> > la ra, ret_from_exception
> > tail ret_from_fork
> >
>
> I don't believe so due to the return address stack. It was shown in this
> patch [1] that a 7% performance improvement can be seen on existing
> riscv hardware by performing the extra jump. Doing tail calls should be
> avoided on riscv since the hardware can be expected to predict the
> return address incorrectly every time if the return address is manually
> changed.

Fair enough, thanks. Though no link to said patch given.

Maciej