go/src/internal
Lance Yang cb12198de5 runtime: optimize permission changes with mprotect
On Linux, both mprotect() and mmap() acquire the mmap_lock (in writer mode),
posing scalability challenges.

The mmap_lock (formerly called mmap_sem) is a reader/writer lock that controls
access to a process's address space; before making changes there (mapping in a
new range, for example), the kernel must acquire that lock.

Page-fault handling must also acquire mmap_lock (in reader mode) to ensure that
the address space doesn't change in surprising ways while a fault is being resolved.

A process can have a large address space and many threads running (and incurring
page faults) concurrently, turning mmap_lock into a significant bottleneck.

While both mmap() and mprotect() are protected by the mmap_lock, the shorter
duration of mprotect system call, due to their simpler nature, results in a reduced
locking time for the mmap_lock.

Change-Id: I7f929544904e31eab34d0d8a9e368abe4de64637
GitHub-Last-Rev: 6f27a216b4
GitHub-Pull-Request: golang/go#65038
Reviewed-on: https://go-review.googlesource.com/c/go/+/554935
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Mauri de Souza Meneguzzo <mauri870@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
2024-03-19 14:54:29 +00:00
..
abi runtime: use .Pointers() instead of manual checking 2024-03-04 17:34:30 +00:00
asan internal/asan: add new package 2024-02-13 20:39:58 +00:00
bisect internal/bisect: replace atomicPointerDedup to simplify the code 2024-03-15 15:59:51 +00:00
buildcfg cmd/dist,internal: add GOARM64 environment variable 2024-03-06 01:33:19 +00:00
bytealg strings: make use of sizeclasses in (*Builder).Grow 2024-02-19 19:51:15 +00:00
cfg cmd/dist,internal: add GOARM64 environment variable 2024-03-06 01:33:19 +00:00
chacha8rand all: run go fmt 2024-02-28 20:35:05 +00:00
coverage internal/coverage/encodemeta: simplify appending zero values 2024-02-29 17:16:10 +00:00
cpu all: fix typos 2024-01-30 20:09:45 +00:00
dag
diff internal/diff: add missing 'as' in comment 2023-11-08 14:13:04 +00:00
fmtsort internal/fmtsort: makeChans pin pointer 2023-10-30 21:00:16 +00:00
fuzz internal/fuzz: remove useless code 2024-03-07 00:20:34 +00:00
goarch
godebug internal/godebugs: test for use of IncNonDefault 2024-03-09 14:19:39 +00:00
godebugs time: avoid stale receives after Timer/Ticker Stop/Reset return 2024-03-14 18:25:25 +00:00
goexperiment runtime: add execution tracer v2 behind GOEXPERIMENT=exectracer2 2023-11-10 15:49:59 +00:00
goos
goroot internal/goroot: in IsStandardPackage check for go source files 2024-02-08 18:16:28 +00:00
gover go/version: add new package 2023-11-06 23:20:32 +00:00
goversion internal/goversion: update Version to 1.23 2024-01-19 19:23:40 +00:00
intern all: use built-in clear to clear maps 2023-07-27 22:07:13 +00:00
itoa internal/itoa, os: move os.uitox to itoa.Uitox 2023-08-11 02:53:50 +00:00
lazyregexp
lazytemplate
msan internal/msan: add new package 2024-02-20 20:50:21 +00:00
nettrace internal/nettrace: fix comment typo 2023-10-19 11:57:14 +00:00
obscuretestdata
oserror
pkgbits
platform cmd/dist,cmd/link: enable PIE buildmode on openbsd/arm64 2024-03-16 02:25:22 +00:00
poll internal/poll: change Fsync to fallback to syscall.Fsync on darwin 2024-03-07 19:20:48 +00:00
profile internal/pprof: remove unused code 2024-02-08 17:57:40 +00:00
race all: drop old +build lines 2023-10-19 23:33:27 +00:00
reflectlite runtime: use .Pointers() instead of manual checking 2024-03-04 17:34:30 +00:00
runtime/syscall runtime: optimize permission changes with mprotect 2024-03-19 14:54:29 +00:00
safefilepath path/filepath: add Localize 2024-02-26 18:08:14 +00:00
saferio all: rewrite internal/saferio.SliceCap using generics and add func SliceCapWithSize 2023-08-31 00:34:05 +00:00
singleflight
syscall net: fixes to dnsReadConfig in dnsconfig_windows.go 2024-03-15 10:25:02 +00:00
sysinfo internal/sysinfo: print cpu type from cpuinfo when internal cpu name is empty on Linux 2023-08-17 21:40:36 +00:00
testenv cmd/link: support -bindnow option and permit use of "-Wl,-z,now" 2024-03-15 16:11:52 +00:00
testlog
testpty
trace internal/trace/v2: support old trace format 2024-03-14 02:20:08 +00:00
txtar
types go/types, types2: quote user-supplied names in error messages 2024-03-18 18:59:40 +00:00
unsafeheader
xcoff internal/xcoff: fix typo in comment 2024-03-04 17:32:51 +00:00
zstd internal/zstd: avoid panic when windowSize is negative 2024-01-30 04:10:45 +00:00