Re: [PATCH] mm: Remove stub for non_swap_entry()

From: Peter Xu
Date: Thu Apr 14 2022 - 11:45:26 EST


On Thu, Apr 14, 2022 at 03:48:33PM +1000, Alistair Popple wrote:
> Peter Xu <peterx@xxxxxxxxxx> writes:
>
> > The stub for non_swap_entry() may not help much, because MAX_SWAPFILES has
> > already contained all the information to decide whether a swap entry is
> > real swap entry of pesudo ones (migrations, ...).
> >
> > There can be some performance influences on non_swap_entry() with below
> > conditions all met:
> >
> > !CONFIG_MIGRATION && !CONFIG_MEMORY_FAILURE && !CONFIG_DEVICE_PRIVATE
> >
> > But that's definitely not the major config most machines will use, at the
> > meantime it's already in a slow path of swap entry (being parsed from a
> > swap pte), so IMHO it shouldn't be a major issue. Also according to the
> > analysis from Alistair, somehow the stub didn't do the job right [1].
>
> I wasn't so much concerned about execution speed given it's on the slow path
> anyway but overall code size, which is one reason all those config options might
> be disabled. However in practice it made little to no difference as those config
> options already remove most of the extra code so I agree we can drop the stub.

I see, yeah that's a good point.

I'd wildly guess a minumum set of Linux build could still like that, but
not strongly, as I'd first think about not having CONFIG_SWAP at all if so.

>
> Reviewed-by: Alistair Popple <apopple@xxxxxxxxxx>

Thanks!

--
Peter Xu