<feed xmlns='http://www.w3.org/2005/Atom'>
<title>go/src/runtime/mpagealloc.go, branch json-isValidNumber</title>
<subtitle>Fork of Go programming language with my patches.</subtitle>
<id>http://git.kilabit.info/go/atom?h=json-isValidNumber</id>
<link rel='self' href='http://git.kilabit.info/go/atom?h=json-isValidNumber'/>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/'/>
<updated>2023-02-08T14:52:12Z</updated>
<entry>
<title>runtime: correct typos</title>
<updated>2023-02-08T14:52:12Z</updated>
<author>
<name>Oleksandr Redko</name>
<email>oleksandr.red+github@gmail.com</email>
</author>
<published>2023-02-07T09:09:24Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/commit/?id=1a09d57de58a90987789ef637083aac21533eeb7'/>
<id>urn:sha1:1a09d57de58a90987789ef637083aac21533eeb7</id>
<content type='text'>
- Fix typo in throw error message for arena.
- Correct typos in assembly and Go comments.
- Fix log message in TestTraceCPUProfile.

Change-Id: I874c9e8cd46394448b6717bc6021aa3ecf319d16
GitHub-Last-Rev: d27fad4d3cea81cc7a4ca6917985bcf5fa49b0e0
GitHub-Pull-Request: golang/go#58375
Reviewed-on: https://go-review.googlesource.com/c/go/+/465975
Reviewed-by: David Chase &lt;drchase@google.com&gt;
Reviewed-by: Ian Lance Taylor &lt;iant@google.com&gt;
Run-TryBot: Ian Lance Taylor &lt;iant@google.com&gt;
Auto-Submit: Ian Lance Taylor &lt;iant@google.com&gt;
TryBot-Result: Gopher Robot &lt;gobot@golang.org&gt;
</content>
</entry>
<entry>
<title>runtime: fix a few function names on comments</title>
<updated>2022-10-26T02:39:39Z</updated>
<author>
<name>cui fliter</name>
<email>imcusg@gmail.com</email>
</author>
<published>2022-10-03T01:32:11Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/commit/?id=069d1fc9e2085d93ea256b6c49b5d7c3026f79a3'/>
<id>urn:sha1:069d1fc9e2085d93ea256b6c49b5d7c3026f79a3</id>
<content type='text'>
Change-Id: I4be0b1e612dcc21ca6bb7d4395f1c0aa52480759
GitHub-Last-Rev: 032480c4c9ddb2bedea26b01bb80b8a079bfdcf3
GitHub-Pull-Request: golang/go#55993
Reviewed-on: https://go-review.googlesource.com/c/go/+/437518
Reviewed-by: hopehook &lt;hopehook@golangcn.org&gt;
Reviewed-by: Keith Randall &lt;khr@google.com&gt;
TryBot-Result: Gopher Robot &lt;gobot@golang.org&gt;
Reviewed-by: Carlos Amedee &lt;carlos@golang.org&gt;
Reviewed-by: Keith Randall &lt;khr@golang.org&gt;
Run-TryBot: hopehook &lt;hopehook@golangcn.org&gt;
</content>
</entry>
<entry>
<title>runtime/metrics: add CPU stats</title>
<updated>2022-09-16T16:32:20Z</updated>
<author>
<name>Michael Anthony Knyszek</name>
<email>mknyszek@google.com</email>
</author>
<published>2022-05-06T20:11:28Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/commit/?id=b7c28f484ddbc8267273c997e1bcc83a1391b5f7'/>
<id>urn:sha1:b7c28f484ddbc8267273c997e1bcc83a1391b5f7</id>
<content type='text'>
This changes adds a breakdown for estimated CPU usage by time. These
estimates are not based on real on-CPU counters, so each metric has a
disclaimer explaining so. They can, however, be more reasonably
compared to a total CPU time metric that this change also adds.

Fixes #47216.

Change-Id: I125006526be9f8e0d609200e193da5a78d9935be
Reviewed-on: https://go-review.googlesource.com/c/go/+/404307
Reviewed-by: Michael Pratt &lt;mpratt@google.com&gt;
Reviewed-by: Josh MacDonald &lt;jmacd@lightstep.com&gt;
Auto-Submit: Michael Knyszek &lt;mknyszek@google.com&gt;
Reviewed-by: David Chase &lt;drchase@google.com&gt;
Run-TryBot: Michael Knyszek &lt;mknyszek@google.com&gt;
TryBot-Result: Gopher Robot &lt;gobot@golang.org&gt;
</content>
</entry>
<entry>
<title>runtime: remove alignment padding in mheap and pageAlloc</title>
<updated>2022-09-08T16:06:00Z</updated>
<author>
<name>Michael Anthony Knyszek</name>
<email>mknyszek@google.com</email>
</author>
<published>2022-09-07T20:11:00Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/commit/?id=e28cc362a825b297fa8a10dc95d7c0d2e2b21dfc'/>
<id>urn:sha1:e28cc362a825b297fa8a10dc95d7c0d2e2b21dfc</id>
<content type='text'>
All subfields use atomic types to ensure alignment, so there's no more
need for these fields.

Change-Id: Iada4253f352a074073ce603f1f6b07cbd5b7c58a
Reviewed-on: https://go-review.googlesource.com/c/go/+/429220
Run-TryBot: Michael Knyszek &lt;mknyszek@google.com&gt;
TryBot-Result: Gopher Robot &lt;gobot@golang.org&gt;
Auto-Submit: Michael Knyszek &lt;mknyszek@google.com&gt;
Reviewed-by: Keith Randall &lt;khr@google.com&gt;
Reviewed-by: Keith Randall &lt;khr@golang.org&gt;
</content>
</entry>
<entry>
<title>runtime: remove atomic store requirement on pageAlloc.chunks</title>
<updated>2022-09-08T16:05:56Z</updated>
<author>
<name>Michael Anthony Knyszek</name>
<email>mknyszek@google.com</email>
</author>
<published>2022-09-07T20:03:25Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/commit/?id=1c59199c919419293075ac9c93b27b033e2733f9'/>
<id>urn:sha1:1c59199c919419293075ac9c93b27b033e2733f9</id>
<content type='text'>
pageAlloc.chunks used to require an atomic store when growing the heap
because the scavenger would look at the list without locking the heap
lock. However, the scavenger doesn't do that anymore, and it looks like
nothing really does at all.

This change updates the comment and makes the store non-atomic.

Change-Id: Ib452d147861060f9f6e74e2d98ee111cf89ce8f5
Reviewed-on: https://go-review.googlesource.com/c/go/+/429219
Auto-Submit: Michael Knyszek &lt;mknyszek@google.com&gt;
Reviewed-by: Keith Randall &lt;khr@google.com&gt;
TryBot-Result: Gopher Robot &lt;gobot@golang.org&gt;
Run-TryBot: Michael Knyszek &lt;mknyszek@google.com&gt;
Reviewed-by: Keith Randall &lt;khr@golang.org&gt;
</content>
</entry>
<entry>
<title>runtime: fix comment typo in mpagealloc.go</title>
<updated>2022-08-31T16:27:09Z</updated>
<author>
<name>bqyang</name>
<email>clamyang2018@gmail.com</email>
</author>
<published>2022-08-31T08:28:13Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/commit/?id=bc0a033266eeaed189a5c77becd45b861fd245f5'/>
<id>urn:sha1:bc0a033266eeaed189a5c77becd45b861fd245f5</id>
<content type='text'>
leve --&gt; level

Change-Id: Ia5ff46c79c4dda2df426ec75d69e8fcede909b47
GitHub-Last-Rev: e57cad22d99b74c7e220f4d5a7b03a830544aea9
GitHub-Pull-Request: golang/go#54788
Reviewed-on: https://go-review.googlesource.com/c/go/+/426974
Run-TryBot: Daniel Martí &lt;mvdan@mvdan.cc&gt;
Reviewed-by: Keith Randall &lt;khr@golang.org&gt;
TryBot-Result: Gopher Robot &lt;gobot@golang.org&gt;
Reviewed-by: Heschi Kreinick &lt;heschi@google.com&gt;
Auto-Submit: Keith Randall &lt;khr@google.com&gt;
Reviewed-by: Daniel Martí &lt;mvdan@mvdan.cc&gt;
Reviewed-by: Keith Randall &lt;khr@google.com&gt;
</content>
</entry>
<entry>
<title>runtime: remove pageAlloc.scav padding for atomic field alignment</title>
<updated>2022-08-19T15:53:47Z</updated>
<author>
<name>Cuong Manh Le</name>
<email>cuong.manhle.vn@gmail.com</email>
</author>
<published>2022-08-19T11:35:42Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/commit/?id=f324355d1f482362b87ec4f95ceac00d4b4de797'/>
<id>urn:sha1:f324355d1f482362b87ec4f95ceac00d4b4de797</id>
<content type='text'>
CL 404096 makes atomic.Int64 8 bytes aligned everywhere.

Change-Id: I5a676f646260d6391bb071f9376cbdb1553e6e6f
Reviewed-on: https://go-review.googlesource.com/c/go/+/424925
Auto-Submit: Cuong Manh Le &lt;cuong.manhle.vn@gmail.com&gt;
Reviewed-by: Joedian Reid &lt;joedian@golang.org&gt;
TryBot-Result: Gopher Robot &lt;gobot@golang.org&gt;
Run-TryBot: Cuong Manh Le &lt;cuong.manhle.vn@gmail.com&gt;
Reviewed-by: Michael Knyszek &lt;mknyszek@google.com&gt;
</content>
</entry>
<entry>
<title>runtime: change maxSearchAddr into a helper function</title>
<updated>2022-05-11T03:28:01Z</updated>
<author>
<name>Matthew Dempsky</name>
<email>mdempsky@google.com</email>
</author>
<published>2022-03-28T16:30:41Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/commit/?id=ccb798741b9bd9d5eda56648a8b3383e6e55cfcd'/>
<id>urn:sha1:ccb798741b9bd9d5eda56648a8b3383e6e55cfcd</id>
<content type='text'>
This avoids a dependency on the compiler statically initializing
maxSearchAddr, which is necessary so we can disable the (overly
aggressive and spec non-conforming) optimizations in cmd/compile and
gccgo.

Updates #51913.

Change-Id: I424e62c81c722bb179ed8d2d8e188274a1aeb7b6
Reviewed-on: https://go-review.googlesource.com/c/go/+/396194
Reviewed-by: Michael Knyszek &lt;mknyszek@google.com&gt;
Reviewed-by: Austin Clements &lt;austin@google.com&gt;
Run-TryBot: Matthew Dempsky &lt;mdempsky@google.com&gt;
TryBot-Result: Gopher Robot &lt;gobot@golang.org&gt;
</content>
</entry>
<entry>
<title>runtime: redesign scavenging algorithm</title>
<updated>2022-05-03T15:13:53Z</updated>
<author>
<name>Michael Anthony Knyszek</name>
<email>mknyszek@google.com</email>
</author>
<published>2022-04-10T20:34:17Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/commit/?id=91f863013e6b5ba870f6bfbfda0b735cf54fb3ca'/>
<id>urn:sha1:91f863013e6b5ba870f6bfbfda0b735cf54fb3ca</id>
<content type='text'>
Currently the runtime's scavenging algorithm involves running from the
top of the heap address space to the bottom (or as far as it gets) once
per GC cycle. Once it treads some ground, it doesn't tread it again
until the next GC cycle.

This works just fine for the background scavenger, for heap-growth
scavenging, and for debug.FreeOSMemory. However, it breaks down in the
face of a memory limit for small heaps in the tens of MiB. Basically,
because the scavenger never retreads old ground, it's completely
oblivious to new memory it could scavenge, and that it really *should*
in the face of a memory limit.

Also, every time some thread goes to scavenge in the runtime, it
reserves what could be a considerable amount of address space, hiding it
from other scavengers.

This change modifies and simplifies the implementation overall. It's
less code with complexities that are much better encapsulated. The
current implementation iterates optimistically over the address space
looking for memory to scavenge, keeping track of what it last saw. The
new implementation does the same, but instead of directly iterating over
pages, it iterates over chunks. It maintains an index of chunks (as a
bitmap over the address space) that indicate which chunks may contain
scavenge work. The page allocator populates this index, while scavengers
consume it and iterate over it optimistically.

This has a two key benefits:
1. Scavenging is much simpler: find a candidate chunk, and check it,
   essentially just using the scavengeOne fast path. There's no need for
   the complexity of iterating beyond one chunk, because the index is
   lock-free and already maintains that information.
2. If pages are freed to the page allocator (always guaranteed to be
   unscavenged), the page allocator immediately notifies all scavengers
   of the new source of work, avoiding the hiding issues of the old
   implementation.

One downside of the new implementation, however, is that it's
potentially more expensive to find pages to scavenge. In the past, if
a single page would become free high up in the address space, the
runtime's scavengers would ignore it. Now that scavengers won't, one or
more scavengers may need to iterate potentially across the whole heap to
find the next source of work. For the background scavenger, this just
means a potentially less reactive scavenger -- overall it should still
use the same amount of CPU. It means worse overheads for memory limit
scavenging, but that's not exactly something with a baseline yet.

In practice, this shouldn't be too bad, hopefully since the chunk index
is extremely compact. For a 48-bit address space, the index is only 8
MiB in size at worst, but even just one physical page in the index is
able to support up to 128 GiB heaps, provided they aren't terribly
sparse. On 32-bit platforms, the index is only 128 bytes in size.

For #48409.

Change-Id: I72b7e74365046b18c64a6417224c5d85511194fb
Reviewed-on: https://go-review.googlesource.com/c/go/+/399474
Reviewed-by: Michael Pratt &lt;mpratt@google.com&gt;
Run-TryBot: Michael Knyszek &lt;mknyszek@google.com&gt;
TryBot-Result: Gopher Robot &lt;gobot@golang.org&gt;
</content>
</entry>
<entry>
<title>runtime: make the scavenger and allocator respect the memory limit</title>
<updated>2022-05-03T15:13:45Z</updated>
<author>
<name>Michael Anthony Knyszek</name>
<email>mknyszek@google.com</email>
</author>
<published>2022-03-30T22:10:49Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/commit/?id=b4d81147d8dc26c8f7d6822b6249311d569af1de'/>
<id>urn:sha1:b4d81147d8dc26c8f7d6822b6249311d569af1de</id>
<content type='text'>
This change does everything necessary to make the memory allocator and
the scavenger respect the memory limit. In particular, it:

- Adds a second goal for the background scavenge that's based on the
  memory limit, setting a target 5% below the limit to make sure it's
  working hard when the application is close to it.
- Makes span allocation assist the scavenger if the next allocation is
  about to put total memory use above the memory limit.
- Measures any scavenge assist time and adds it to GC assist time for
  the sake of GC CPU limiting, to avoid a death spiral as a result of
  scavenging too much.

All of these changes have a relatively small impact, but each is
intimately related and thus benefit from being done together.

For #48409.

Change-Id: I35517a752f74dd12a151dd620f102c77e095d3e8
Reviewed-on: https://go-review.googlesource.com/c/go/+/397017
Reviewed-by: Michael Pratt &lt;mpratt@google.com&gt;
Run-TryBot: Michael Knyszek &lt;mknyszek@google.com&gt;
TryBot-Result: Gopher Robot &lt;gobot@golang.org&gt;
</content>
</entry>
</feed>
