Re: [PATCH 0/8] Remove unused parameters in page_table_check

From: Andrew Morton
Date: Mon Jul 24 2023 - 13:02:36 EST


On Sat, 22 Jul 2023 17:48:31 -0400 Pasha Tatashin <pasha.tatashin@xxxxxxxxxx> wrote:

> On Thu, Jul 13, 2023 at 5:25 AM Kemeng Shi <shikemeng@xxxxxxxxxxxxxxx> wrote:
> >
> > Hi all, this series remove unused parameters in functions from
> > page_table_check. The first 2 patches remove unused mm and addr
> > parameters in static common functions page_table_check_clear and
> > page_table_check_set. The last 6 patches remove unused addr parameter
> > in some externed functions which only need addr for cleaned
> > page_table_check_clear or page_table_check_set. There is no intended
> > functional change. Thanks!
>
> NAK
>
> Both, mm and addr are common arguments that are used for PTE handling
> in many parts of memory management even when they are not used in
> every function.
>
> Currently, they are not used in page table check, but it is possible
> we may need to use them in the future when support for other arches or
> different types of page tables (i.e. extended page table) is added. It
> is going to be hard to again modify all arch dependent code to add
> these arguments back.
>
> Also, internally at Google we are using these arguments, as we have a
> module that maps user memory in a way that is incompatible with
> upstream, and these arguments are used to support this module.
>

I don't think these are very good arguments for carrying cruft in the
mainline kernel.

If such an architecture is introduced in the future or if google
upstreams that module then we can restore one or both of these
arguments at that time. This is hardly insurmountable:

arch/arm64/include/asm/pgtable.h | 12 +++---
arch/riscv/include/asm/pgtable.h | 12 +++---
arch/x86/include/asm/pgtable.h | 16 ++++----
include/linux/page_table_check.h | 66 ++++++++++++--------------------
include/linux/pgtable.h | 6 +--
mm/page_table_check.c | 50 +++++++++---------------
6 files changed, 65 insertions(+), 97 deletions(-)