NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

kern/55432: Optimize uvm_fault for pagesize larger than 4k



>Number:         55432
>Category:       kern
>Synopsis:       Optimize uvm_fault for pagesize larger than 4k
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Tue Jun 30 07:05:00 +0000 2020
>Originator:     Rin Okuyama
>Release:        9.99.68 and netbsd-9 (and older release branches also)
>Organization:
Department of Physics, Meiji University
>Environment:
NetBSD obs266 9.99.68 NetBSD 9.99.68 (OBS266) #284: Mon Jun 29 23:06:25 JST 2020  rin@latipes:/usr/src/sys/arch/evbppc/compile/OBS266 evbppc

NetBSD erlite 9.0_STABLE NetBSD 9.0_STABLE (ERLITE) #1: Sun Jun 28 23:05:51 JST 2020  rin@latipes:/build/work/src/sys/arch/evbmips/compile/ERLITE evbmips
>Description:
uvm_fault() resolves not only a page containing the fault address, but
also pages around it speculatively. Number of pages to be resolved is
hardcoded for types of fault:

https://nxr.netbsd.org/xref/src/sys/uvm/uvm_fault.c#155

These values are taken from FreeBSD, whose main targets have 4k pages.

The problem is for pages larger than 4k, say, if the machine has 16k
pages, 4 times of pages are resolved speculatively. This seems too
much. Therefore, I would like to propose to rescale these values so
that amount of memory to be resolved is approximately same as that
for 4k page:

http://www.netbsd.org/~rin/uvm_fault_20200630.patch

With this patch, nothing changes for 4k pages. (Also, if pagesize is
smaller than 4k, i.e., mc68010, do not rescale for safety; it is
already suffering from memory shortage.)

For machines with pagesize larger than 4k, the performance is clearly
improved. I've carried out simple benchmark by measuring time to make
pkgsrc/lang/python37:

For PowerPC 405GPr (powerpc/ibm4xx, 16k pages):
before:	12414.44 real     11117.19 user      1172.01 sys
after:	12103.14 real     10859.51 user      1125.75 sys
Improve in real: 2.51%

For Cavium CN50xx (evbmips/mips64, 8k pages):
before:	3607.57 real      2862.35 user       472.94 sys
after:	3519.00 real      2844.17 user       430.26 sys
Improve in real: 2.46%

(Note that since -current is unstable for mips64, netbsd-9 is used
for Cavium CN50xx.)

Thoughts? Can I commit the patch?

Also, the current hard-coded value may be not optimal even for 4k
pages. It is take from FreeBSD as of 1998, and FreeBSD seems to adjust
# of pages on demand now. See their sys/vm/vm_fault.c.
>How-To-Repeat:
Code inspection and benchmark as described above.
>Fix:
Described above.



Home | Main Index | Thread Index | Old Index