]> git.baikalelectronics.ru Git - kernel.git/commit
powerpc/mm: Only read faulting instruction when necessary in do_page_fault()
authorChristophe Leroy <christophe.leroy@c-s.fr>
Wed, 23 May 2018 08:53:22 +0000 (10:53 +0200)
committerMichael Ellerman <mpe@ellerman.id.au>
Thu, 24 May 2018 14:08:25 +0000 (00:08 +1000)
commitca0ebf1dbde835f68206630ecc22cc6e9354c605
tree279e53bbb24914032e0546e32e807db92270c2ba
parentde68a3f344c717250ec5d08c70c5a1c7955415a3
powerpc/mm: Only read faulting instruction when necessary in do_page_fault()

Commit ad05188e1f950 ("powerpc: Avoid taking a data miss on every
userspace instruction miss") has shown that limiting the read of
faulting instruction to likely cases improves performance.

This patch goes further into this direction by limiting the read
of the faulting instruction to the only cases where it is likely
needed.

On an MPC885, with the same benchmark app as in the commit referred
above, we see a reduction of about 3900 dTLB misses (approx 3%):

Before the patch:
 Performance counter stats for './fault 500' (10 runs):

         683033312      cpu-cycles                                                    ( +-  0.03% )
            134538      dTLB-load-misses                                              ( +-  0.03% )
             46099      iTLB-load-misses                                              ( +-  0.02% )
             19681      faults                                                        ( +-  0.02% )

       5.389747878 seconds time elapsed                                          ( +-  0.06% )

With the patch:

 Performance counter stats for './fault 500' (10 runs):

         682112862      cpu-cycles                                                    ( +-  0.03% )
            130619      dTLB-load-misses                                              ( +-  0.03% )
             46073      iTLB-load-misses                                              ( +-  0.05% )
             19681      faults                                                        ( +-  0.01% )

       5.381342641 seconds time elapsed                                          ( +-  0.07% )

The proper work of the huge stack expansion was tested with the
following app:

int main(int argc, char **argv)
{
char buf[1024 * 1025];

sprintf(buf, "Hello world !\n");
printf(buf);

exit(0);
}

Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
Reviewed-by: Nicholas Piggin <npiggin@gmail.com>
[mpe: Add include of pagemap.h to fix build errors]
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/mm/fault.c