[go] runtime: add runtime.free, runtime.freesized, runtime.freetracked to reduce GC work

35 views
Skip to first unread message

t hepudds (Gerrit)

unread,
Aug 8, 2025, 5:32:04 PMAug 8
to goph...@pubsubhelper.golang.org, Carlo Alberto Ferraris, golang-co...@googlegroups.com

New activity on the change

Open in Gerrit

Related details

Attention set is empty
Submit Requirements:
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
  • requirement is not satisfiedTryBots-Pass
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: Icceaa0f79f85c70cd1a718f9a4e7f0cf3d77803c
Gerrit-Change-Number: 673695
Gerrit-PatchSet: 25
Gerrit-Owner: t hepudds <thepud...@gmail.com>
Gerrit-CC: Carlo Alberto Ferraris <carloalber...@gmail.com>
Gerrit-CC: Michael Knyszek <mkny...@google.com>
Gerrit-Comment-Date: Fri, 08 Aug 2025 21:32:00 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: No
unsatisfied_requirement
open
diffy

t hepudds (Gerrit)

unread,
Aug 18, 2025, 1:00:00 AMAug 18
to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

t hepudds uploaded new patchset

t hepudds uploaded patch set #26 to this change.
Open in Gerrit

Related details

Attention set is empty
Submit Requirements:
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
  • requirement is not satisfiedTryBots-Pass
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: newpatchset
Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: Icceaa0f79f85c70cd1a718f9a4e7f0cf3d77803c
Gerrit-Change-Number: 673695
Gerrit-PatchSet: 26
unsatisfied_requirement
open
diffy

t hepudds (Gerrit)

unread,
Aug 18, 2025, 2:45:49 PMAug 18
to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

t hepudds uploaded new patchset

t hepudds uploaded patch set #27 to this change.
Open in Gerrit

Related details

Attention set is empty
Submit Requirements:
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
  • requirement is not satisfiedTryBots-Pass
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: newpatchset
Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: Icceaa0f79f85c70cd1a718f9a4e7f0cf3d77803c
Gerrit-Change-Number: 673695
Gerrit-PatchSet: 27
unsatisfied_requirement
open
diffy

t hepudds (Gerrit)

unread,
Aug 18, 2025, 2:50:12 PMAug 18
to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

t hepudds uploaded new patchset

t hepudds uploaded patch set #28 to this change.
Open in Gerrit

Related details

Attention set is empty
Submit Requirements:
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
  • requirement is not satisfiedTryBots-Pass
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: newpatchset
Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: Icceaa0f79f85c70cd1a718f9a4e7f0cf3d77803c
Gerrit-Change-Number: 673695
Gerrit-PatchSet: 28
unsatisfied_requirement
open
diffy

t hepudds (Gerrit)

unread,
Aug 18, 2025, 7:11:36 PMAug 18
to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

t hepudds uploaded new patchset

t hepudds uploaded patch set #29 to this change.
Open in Gerrit

Related details

Attention set is empty
Submit Requirements:
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
  • requirement is not satisfiedTryBots-Pass
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: newpatchset
Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: Icceaa0f79f85c70cd1a718f9a4e7f0cf3d77803c
Gerrit-Change-Number: 673695
Gerrit-PatchSet: 29
unsatisfied_requirement
open
diffy

t hepudds (Gerrit)

unread,
Aug 21, 2025, 5:37:33 PMAug 21
to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

t hepudds uploaded new patchset

t hepudds uploaded patch set #30 to this change.
Open in Gerrit

Related details

Attention set is empty
Submit Requirements:
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
  • requirement is not satisfiedTryBots-Pass
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: newpatchset
Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: Icceaa0f79f85c70cd1a718f9a4e7f0cf3d77803c
Gerrit-Change-Number: 673695
Gerrit-PatchSet: 30
unsatisfied_requirement
open
diffy

t hepudds (Gerrit)

unread,
Aug 21, 2025, 10:56:42 PMAug 21
to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

t hepudds uploaded new patchset

t hepudds uploaded patch set #31 to this change.
Open in Gerrit

Related details

Attention set is empty
Submit Requirements:
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
  • requirement is not satisfiedTryBots-Pass
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: newpatchset
Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: Icceaa0f79f85c70cd1a718f9a4e7f0cf3d77803c
Gerrit-Change-Number: 673695
Gerrit-PatchSet: 31
unsatisfied_requirement
open
diffy

t hepudds (Gerrit)

unread,
Aug 21, 2025, 11:23:35 PMAug 21
to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

t hepudds uploaded new patchset

t hepudds uploaded patch set #32 to this change.
Open in Gerrit

Related details

Attention set is empty
Submit Requirements:
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
  • requirement is not satisfiedTryBots-Pass
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: newpatchset
Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: Icceaa0f79f85c70cd1a718f9a4e7f0cf3d77803c
Gerrit-Change-Number: 673695
Gerrit-PatchSet: 32
unsatisfied_requirement
open
diffy

t hepudds (Gerrit)

unread,
Aug 22, 2025, 12:11:09 AMAug 22
to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

t hepudds uploaded new patchset

t hepudds uploaded patch set #33 to this change.
Open in Gerrit

Related details

Attention set is empty
Submit Requirements:
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
  • requirement is not satisfiedTryBots-Pass
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: newpatchset
Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: Icceaa0f79f85c70cd1a718f9a4e7f0cf3d77803c
Gerrit-Change-Number: 673695
Gerrit-PatchSet: 33
unsatisfied_requirement
open
diffy

t hepudds (Gerrit)

unread,
Aug 22, 2025, 12:25:59 AMAug 22
to goph...@pubsubhelper.golang.org, Carlo Alberto Ferraris, golang-co...@googlegroups.com

t hepudds voted Commit-Queue+1

Commit-Queue+1
Open in Gerrit

Related details

Attention set is empty
Submit Requirements:
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
  • requirement is not satisfiedTryBots-Pass
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: Icceaa0f79f85c70cd1a718f9a4e7f0cf3d77803c
Gerrit-Change-Number: 673695
Gerrit-PatchSet: 33
Gerrit-Owner: t hepudds <thepud...@gmail.com>
Gerrit-Reviewer: t hepudds <thepud...@gmail.com>
Gerrit-CC: Carlo Alberto Ferraris <carloalber...@gmail.com>
Gerrit-CC: Michael Knyszek <mkny...@google.com>
Gerrit-Comment-Date: Fri, 22 Aug 2025 04:25:55 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
unsatisfied_requirement
open
diffy

t hepudds (Gerrit)

unread,
Aug 22, 2025, 8:26:20 AMAug 22
to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

t hepudds uploaded new patchset

t hepudds uploaded patch set #34 to this change.
Following approvals got outdated and were removed:
  • TryBots-Pass: LUCI-TryBot-Result+1 by Go LUCI
Open in Gerrit

Related details

Attention set is empty
Submit Requirements:
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
  • requirement is not satisfiedTryBots-Pass
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: newpatchset
Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: Icceaa0f79f85c70cd1a718f9a4e7f0cf3d77803c
Gerrit-Change-Number: 673695
Gerrit-PatchSet: 34
Gerrit-Owner: t hepudds <thepud...@gmail.com>
unsatisfied_requirement
open
diffy

t hepudds (Gerrit)

unread,
Aug 22, 2025, 9:26:49 AMAug 22
to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

t hepudds uploaded new patchset

t hepudds uploaded patch set #35 to this change.
Open in Gerrit

Related details

Attention set is empty
Submit Requirements:
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
  • requirement is not satisfiedTryBots-Pass
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: newpatchset
Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: Icceaa0f79f85c70cd1a718f9a4e7f0cf3d77803c
Gerrit-Change-Number: 673695
Gerrit-PatchSet: 35
unsatisfied_requirement
open
diffy

t hepudds (Gerrit)

unread,
Aug 22, 2025, 11:44:16 AMAug 22
to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

t hepudds uploaded new patchset

t hepudds uploaded patch set #36 to this change.
Open in Gerrit

Related details

Attention set is empty
Submit Requirements:
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
  • requirement is not satisfiedTryBots-Pass
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: newpatchset
Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: Icceaa0f79f85c70cd1a718f9a4e7f0cf3d77803c
Gerrit-Change-Number: 673695
Gerrit-PatchSet: 36
unsatisfied_requirement
open
diffy

t hepudds (Gerrit)

unread,
Aug 22, 2025, 1:48:02 PMAug 22
to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

t hepudds uploaded new patchset

t hepudds uploaded patch set #37 to this change.
Open in Gerrit

Related details

Attention set is empty
Submit Requirements:
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
  • requirement is not satisfiedTryBots-Pass
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: newpatchset
Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: Icceaa0f79f85c70cd1a718f9a4e7f0cf3d77803c
Gerrit-Change-Number: 673695
Gerrit-PatchSet: 37
unsatisfied_requirement
open
diffy

t hepudds (Gerrit)

unread,
Aug 22, 2025, 1:49:44 PMAug 22
to goph...@pubsubhelper.golang.org, Go LUCI, Carlo Alberto Ferraris, golang-co...@googlegroups.com

t hepudds voted Commit-Queue+1

Commit-Queue+1
Open in Gerrit

Related details

Attention set is empty
Submit Requirements:
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
  • requirement is not satisfiedTryBots-Pass
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: Icceaa0f79f85c70cd1a718f9a4e7f0cf3d77803c
Gerrit-Change-Number: 673695
Gerrit-PatchSet: 37
Gerrit-Owner: t hepudds <thepud...@gmail.com>
Gerrit-Reviewer: t hepudds <thepud...@gmail.com>
Gerrit-CC: Carlo Alberto Ferraris <carloalber...@gmail.com>
Gerrit-CC: Michael Knyszek <mkny...@google.com>
Gerrit-Comment-Date: Fri, 22 Aug 2025 17:49:41 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
unsatisfied_requirement
open
diffy

t hepudds (Gerrit)

unread,
Aug 22, 2025, 2:21:09 PMAug 22
to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

t hepudds uploaded new patchset

t hepudds uploaded patch set #38 to this change.
Open in Gerrit

Related details

Attention set is empty
Submit Requirements:
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    • requirement satisfiedTryBots-Pass
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: newpatchset
    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: Icceaa0f79f85c70cd1a718f9a4e7f0cf3d77803c
    Gerrit-Change-Number: 673695
    Gerrit-PatchSet: 38
    unsatisfied_requirement
    satisfied_requirement
    open
    diffy

    t hepudds (Gerrit)

    unread,
    Aug 22, 2025, 2:31:40 PMAug 22
    to goph...@pubsubhelper.golang.org, Go LUCI, Carlo Alberto Ferraris, golang-co...@googlegroups.com
    Attention needed from Carlo Alberto Ferraris

    t hepudds added 1 comment

    File src/runtime/malloc.go
    Line 1689, Patchset 24: memclrNoHeapPointers(x, size)
    Carlo Alberto Ferraris . resolved

    I suppose the comment was meant to say "even if span.needzero is _not_ set", but more importantly I don't follow why we need to zero out unconditionally - especially since above (line 1560) we only do it if needzero is set.

    t hepudds
     why we need to zero out unconditionally

    Hi Carlo, thanks for taking a look! We need to zero out unconditionally here because the heap object was previously live and likely has non-zero user data, which we would not want to hand back to the user again without zeroing it.

    For the pre-existing mallocgc code, I think there are two maybe distinct concepts:
    1. the span tracks whether zeroing can be skipped (for example, because it is fresh memory from the OS that can be treated as zeroed already, so no need for the malloc code to zero it on the normal allocation path)
    2. a mallocgc caller can say that they are taking responsibility for overwriting any bytes that will be visible to the user, so no need for the malloc code to zero out bytes that will be overwritten before ever being visible to user code.

    For case 1, for this code on the reuse path -- because it was a previously live object, the _span_ might be saying a normal allocation doesn't need to be zeroed, but for a reused _object_ in such a span, we can't rely on that -- the memory for that object was already in the user's hands, regardless of what the rest of the span might look like.

    For case 2, for this code on the reuse path -- the code you commented upon on line 1689 is in the scan case (that is, the heap object contains pointers), and case 2 in general only applies for the noscan case. (The code above on line 1560 at the time was for the noscan case).

    And you are correct that I was missing a word in the original comment.

    All that said, maybe I made some mistake, and I'm very happy to have more eyes on this, so thanks again!

    Finally, some of the code you asked about is now in CL 698515.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Carlo Alberto Ferraris
    Submit Requirements:
      • requirement is not satisfiedCode-Review
      • requirement satisfiedNo-Unresolved-Comments
      • requirement is not satisfiedReview-Enforcement
      • requirement satisfiedTryBots-Pass
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: go
      Gerrit-Branch: master
      Gerrit-Change-Id: Icceaa0f79f85c70cd1a718f9a4e7f0cf3d77803c
      Gerrit-Change-Number: 673695
      Gerrit-PatchSet: 38
      Gerrit-Owner: t hepudds <thepud...@gmail.com>
      Gerrit-Reviewer: t hepudds <thepud...@gmail.com>
      Gerrit-CC: Carlo Alberto Ferraris <carloalber...@gmail.com>
      Gerrit-CC: Michael Knyszek <mkny...@google.com>
      Gerrit-Attention: Carlo Alberto Ferraris <carloalber...@gmail.com>
      Gerrit-Comment-Date: Fri, 22 Aug 2025 18:31:37 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      Comment-In-Reply-To: Carlo Alberto Ferraris <carloalber...@gmail.com>
      unsatisfied_requirement
      satisfied_requirement
      open
      diffy

      t hepudds (Gerrit)

      unread,
      Aug 22, 2025, 2:32:18 PMAug 22
      to goph...@pubsubhelper.golang.org, Go LUCI, Carlo Alberto Ferraris, golang-co...@googlegroups.com
      Attention needed from Carlo Alberto Ferraris

      t hepudds added 1 comment

      Patchset-level comments
      File-level comment, Patchset 38 (Latest):
      t hepudds . resolved

      PTAL when convenient.

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Carlo Alberto Ferraris
      Submit Requirements:
      • requirement is not satisfiedCode-Review
      • requirement satisfiedNo-Unresolved-Comments
      • requirement is not satisfiedReview-Enforcement
      • requirement satisfiedTryBots-Pass
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: go
      Gerrit-Branch: master
      Gerrit-Change-Id: Icceaa0f79f85c70cd1a718f9a4e7f0cf3d77803c
      Gerrit-Change-Number: 673695
      Gerrit-PatchSet: 38
      Gerrit-Owner: t hepudds <thepud...@gmail.com>
      Gerrit-Reviewer: t hepudds <thepud...@gmail.com>
      Gerrit-CC: Carlo Alberto Ferraris <carloalber...@gmail.com>
      Gerrit-CC: Michael Knyszek <mkny...@google.com>
      Gerrit-Attention: Carlo Alberto Ferraris <carloalber...@gmail.com>
      Gerrit-Comment-Date: Fri, 22 Aug 2025 18:32:14 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      unsatisfied_requirement
      satisfied_requirement
      open
      diffy

      t hepudds (Gerrit)

      unread,
      Aug 31, 2025, 9:29:03 AMAug 31
      to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com
      Attention needed from Carlo Alberto Ferraris and Michael Knyszek

      t hepudds uploaded new patchset

      t hepudds uploaded patch set #39 to this change.
      Following approvals got outdated and were removed:
      • TryBots-Pass: LUCI-TryBot-Result+1 by Go LUCI
      Open in Gerrit

      Related details

      Attention is currently required from:
      • Carlo Alberto Ferraris
      • Michael Knyszek
      Submit Requirements:
        • requirement is not satisfiedCode-Review
        • requirement satisfiedNo-Unresolved-Comments
        • requirement is not satisfiedReview-Enforcement
        • requirement is not satisfiedTryBots-Pass
        Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
        Gerrit-MessageType: newpatchset
        Gerrit-Project: go
        Gerrit-Branch: master
        Gerrit-Change-Id: Icceaa0f79f85c70cd1a718f9a4e7f0cf3d77803c
        Gerrit-Change-Number: 673695
        Gerrit-PatchSet: 39
        Gerrit-Owner: t hepudds <thepud...@gmail.com>
        Gerrit-Reviewer: Michael Knyszek <mkny...@google.com>
        Gerrit-Reviewer: t hepudds <thepud...@gmail.com>
        Gerrit-CC: Carlo Alberto Ferraris <carloalber...@gmail.com>
        Gerrit-Attention: Carlo Alberto Ferraris <carloalber...@gmail.com>
        Gerrit-Attention: Michael Knyszek <mkny...@google.com>
        unsatisfied_requirement
        satisfied_requirement
        open
        diffy

        t hepudds (Gerrit)

        unread,
        Aug 31, 2025, 9:43:26 AMAug 31
        to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com
        Attention needed from Carlo Alberto Ferraris and Michael Knyszek

        t hepudds uploaded new patchset

        t hepudds uploaded patch set #40 to this change.
        Open in Gerrit

        Related details

        Attention is currently required from:
        • Carlo Alberto Ferraris
        • Michael Knyszek
        Submit Requirements:
        • requirement is not satisfiedCode-Review
        • requirement satisfiedNo-Unresolved-Comments
        • requirement is not satisfiedReview-Enforcement
        • requirement is not satisfiedTryBots-Pass
        Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
        Gerrit-MessageType: newpatchset
        Gerrit-Project: go
        Gerrit-Branch: master
        Gerrit-Change-Id: Icceaa0f79f85c70cd1a718f9a4e7f0cf3d77803c
        Gerrit-Change-Number: 673695
        Gerrit-PatchSet: 40
        unsatisfied_requirement
        satisfied_requirement
        open
        diffy

        t hepudds (Gerrit)

        unread,
        Aug 31, 2025, 10:03:00 AMAug 31
        to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com
        Attention needed from Carlo Alberto Ferraris and Michael Knyszek

        t hepudds uploaded new patchset

        t hepudds uploaded patch set #41 to this change.
        Open in Gerrit

        Related details

        Attention is currently required from:
        • Carlo Alberto Ferraris
        • Michael Knyszek
        Submit Requirements:
        • requirement is not satisfiedCode-Review
        • requirement satisfiedNo-Unresolved-Comments
        • requirement is not satisfiedReview-Enforcement
        • requirement is not satisfiedTryBots-Pass
        Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
        Gerrit-MessageType: newpatchset
        Gerrit-Project: go
        Gerrit-Branch: master
        Gerrit-Change-Id: Icceaa0f79f85c70cd1a718f9a4e7f0cf3d77803c
        Gerrit-Change-Number: 673695
        Gerrit-PatchSet: 41
        unsatisfied_requirement
        satisfied_requirement
        open
        diffy

        t hepudds (Gerrit)

        unread,
        Aug 31, 2025, 1:45:36 PMAug 31
        to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com
        Attention needed from Carlo Alberto Ferraris and Michael Knyszek

        t hepudds uploaded new patchset

        t hepudds uploaded patch set #42 to this change.
        Open in Gerrit

        Related details

        Attention is currently required from:
        • Carlo Alberto Ferraris
        • Michael Knyszek
        Submit Requirements:
        • requirement is not satisfiedCode-Review
        • requirement satisfiedNo-Unresolved-Comments
        • requirement is not satisfiedReview-Enforcement
        • requirement is not satisfiedTryBots-Pass
        Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
        Gerrit-MessageType: newpatchset
        Gerrit-Project: go
        Gerrit-Branch: master
        Gerrit-Change-Id: Icceaa0f79f85c70cd1a718f9a4e7f0cf3d77803c
        Gerrit-Change-Number: 673695
        Gerrit-PatchSet: 42
        unsatisfied_requirement
        satisfied_requirement
        open
        diffy

        t hepudds (Gerrit)

        unread,
        Sep 8, 2025, 1:43:21 PMSep 8
        to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com
        Attention needed from Carlo Alberto Ferraris and Michael Knyszek

        t hepudds uploaded new patchset

        t hepudds uploaded patch set #43 to this change.
        Open in Gerrit

        Related details

        Attention is currently required from:
        • Carlo Alberto Ferraris
        • Michael Knyszek
        Submit Requirements:
        • requirement is not satisfiedCode-Review
        • requirement satisfiedNo-Unresolved-Comments
        • requirement is not satisfiedReview-Enforcement
        • requirement is not satisfiedTryBots-Pass
        Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
        Gerrit-MessageType: newpatchset
        Gerrit-Project: go
        Gerrit-Branch: master
        Gerrit-Change-Id: Icceaa0f79f85c70cd1a718f9a4e7f0cf3d77803c
        Gerrit-Change-Number: 673695
        Gerrit-PatchSet: 43
        unsatisfied_requirement
        satisfied_requirement
        open
        diffy

        t hepudds (Gerrit)

        unread,
        Sep 19, 2025, 2:37:34 PMSep 19
        to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com
        Attention needed from Carlo Alberto Ferraris and Michael Knyszek

        t hepudds uploaded new patchset

        t hepudds uploaded patch set #44 to this change.
        Open in Gerrit

        Related details

        Attention is currently required from:
        • Carlo Alberto Ferraris
        • Michael Knyszek
        Submit Requirements:
        • requirement is not satisfiedCode-Review
        • requirement satisfiedNo-Unresolved-Comments
        • requirement is not satisfiedReview-Enforcement
        • requirement is not satisfiedTryBots-Pass
        Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
        Gerrit-MessageType: newpatchset
        Gerrit-Project: go
        Gerrit-Branch: master
        Gerrit-Change-Id: Icceaa0f79f85c70cd1a718f9a4e7f0cf3d77803c
        Gerrit-Change-Number: 673695
        Gerrit-PatchSet: 44
        unsatisfied_requirement
        satisfied_requirement
        open
        diffy

        t hepudds (Gerrit)

        unread,
        Sep 19, 2025, 4:59:56 PMSep 19
        to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com
        Attention needed from Carlo Alberto Ferraris and Michael Knyszek

        t hepudds uploaded new patchset

        t hepudds uploaded patch set #45 to this change.
        Open in Gerrit

        Related details

        Attention is currently required from:
        • Carlo Alberto Ferraris
        • Michael Knyszek
        Submit Requirements:
        • requirement is not satisfiedCode-Review
        • requirement satisfiedNo-Unresolved-Comments
        • requirement is not satisfiedReview-Enforcement
        • requirement is not satisfiedTryBots-Pass
        Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
        Gerrit-MessageType: newpatchset
        Gerrit-Project: go
        Gerrit-Branch: master
        Gerrit-Change-Id: Icceaa0f79f85c70cd1a718f9a4e7f0cf3d77803c
        Gerrit-Change-Number: 673695
        Gerrit-PatchSet: 45
        unsatisfied_requirement
        satisfied_requirement
        open
        diffy

        Michael Knyszek (Gerrit)

        unread,
        Sep 23, 2025, 12:12:11 PMSep 23
        to t hepudds, goph...@pubsubhelper.golang.org, Go LUCI, Carlo Alberto Ferraris, golang-co...@googlegroups.com
        Attention needed from Carlo Alberto Ferraris and t hepudds

        Michael Knyszek added 7 comments

        File src/runtime/malloc.go
        Line 998, Patchset 44:// some of which are very expensive and would never be on by default.
        Michael Knyszek . unresolved

        this is already true of doubleCheckMalloc, I think reusing doubleCheckMalloc instead of a new one is fine.

        Line 1301, Patchset 44: if !c.hasReusableNoscan(spc) {
        Michael Knyszek . unresolved

        I think I would prefer this inverted. so, rather than moving around the old code, we make this the special path. it might also be worthwhile to put all that new stuff into its own function; I am slightly worried about making this function too big and have icache problems in the no reuse case.

        with reuse we're already winning. IMO it's OK if we incur the cost of an extra function call.

        Line 1774, Patchset 44:const (
        Michael Knyszek . unresolved

        these debug constants are pretty granular. I understand wanting to avoid log spam (so debugReusableLog seems fine), but maybe the others can be grouped together?

        Line 1914, Patchset 44: // TODO(thepudds): no-op for now for scan. Implemented in later CL in stack.
        Michael Knyszek . unresolved

        throw here maybe, for now?

        Line 2049, Patchset 44:
        //go:linkname strings_freeSized strings.runtimefreesized
        func strings_freeSized(p unsafe.Pointer, size uintptr, noscan bool) bool {
        return freeSized(p, size, noscan)
        }
        Michael Knyszek . unresolved

        I would leave this out of this CL. I'm not yet totally sold on having stdlib call this API directly.

        File src/runtime/mcache.go
        Line 110, Patchset 44: // Clear reusable slots.
        // TODO(thepudds): is this needed? Probably not, probably allocated zeroed, but confirm.
        for i := range c.reusableNoscan {
        c.reusableNoscan[i] = 0
        }
        Michael Knyszek . unresolved

        you can drop this

        Line 343, Patchset 44: for i := range c.reusableNoscan {
        // For noscan objects, the nodes of the linked lists are the resusable heap objects themselves,
        // so we can simply clear the linked list head pointers.
        c.reusableNoscan[i] = 0
        }
        Michael Knyszek . unresolved

        nit: `clear(c.reusableNoscan[:])`

        Open in Gerrit

        Related details

        Attention is currently required from:
        • Carlo Alberto Ferraris
        • t hepudds
        Submit Requirements:
          • requirement is not satisfiedCode-Review
          • requirement is not satisfiedNo-Unresolved-Comments
          • requirement is not satisfiedReview-Enforcement
          • requirement is not satisfiedTryBots-Pass
          Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
          Gerrit-MessageType: comment
          Gerrit-Project: go
          Gerrit-Branch: master
          Gerrit-Change-Id: Icceaa0f79f85c70cd1a718f9a4e7f0cf3d77803c
          Gerrit-Change-Number: 673695
          Gerrit-PatchSet: 44
          Gerrit-Owner: t hepudds <thepud...@gmail.com>
          Gerrit-Reviewer: Michael Knyszek <mkny...@google.com>
          Gerrit-Reviewer: t hepudds <thepud...@gmail.com>
          Gerrit-CC: Carlo Alberto Ferraris <carloalber...@gmail.com>
          Gerrit-Attention: t hepudds <thepud...@gmail.com>
          Gerrit-Attention: Carlo Alberto Ferraris <carloalber...@gmail.com>
          Gerrit-Comment-Date: Tue, 23 Sep 2025 16:12:05 +0000
          Gerrit-HasComments: Yes
          Gerrit-Has-Labels: No
          unsatisfied_requirement
          open
          diffy

          t hepudds (Gerrit)

          unread,
          Oct 26, 2025, 6:45:12 PM (11 days ago) Oct 26
          to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com
          Attention needed from Carlo Alberto Ferraris and t hepudds

          t hepudds uploaded new patchset

          t hepudds uploaded patch set #47 to this change.
          Open in Gerrit

          Related details

          Attention is currently required from:
          • Carlo Alberto Ferraris
          • t hepudds
          Submit Requirements:
          • requirement is not satisfiedCode-Review
          • requirement is not satisfiedNo-Unresolved-Comments
          • requirement is not satisfiedReview-Enforcement
          • requirement is not satisfiedTryBots-Pass
          Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
          Gerrit-MessageType: newpatchset
          Gerrit-Project: go
          Gerrit-Branch: master
          Gerrit-Change-Id: Icceaa0f79f85c70cd1a718f9a4e7f0cf3d77803c
          Gerrit-Change-Number: 673695
          Gerrit-PatchSet: 47
          unsatisfied_requirement
          open
          diffy

          t hepudds (Gerrit)

          unread,
          Oct 26, 2025, 6:46:56 PM (11 days ago) Oct 26
          to goph...@pubsubhelper.golang.org, Go LUCI, Carlo Alberto Ferraris, golang-co...@googlegroups.com
          Attention needed from Carlo Alberto Ferraris

          t hepudds voted Commit-Queue+1

          Commit-Queue+1
          Open in Gerrit

          Related details

          Attention is currently required from:
          • Carlo Alberto Ferraris
          Submit Requirements:
          • requirement is not satisfiedCode-Review
          • requirement is not satisfiedNo-Unresolved-Comments
          • requirement is not satisfiedReview-Enforcement
          • requirement is not satisfiedTryBots-Pass
          Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
          Gerrit-MessageType: comment
          Gerrit-Project: go
          Gerrit-Branch: master
          Gerrit-Change-Id: Icceaa0f79f85c70cd1a718f9a4e7f0cf3d77803c
          Gerrit-Change-Number: 673695
          Gerrit-PatchSet: 47
          Gerrit-Owner: t hepudds <thepud...@gmail.com>
          Gerrit-Reviewer: Michael Knyszek <mkny...@google.com>
          Gerrit-Reviewer: t hepudds <thepud...@gmail.com>
          Gerrit-CC: Carlo Alberto Ferraris <carloalber...@gmail.com>
          Gerrit-Attention: Carlo Alberto Ferraris <carloalber...@gmail.com>
          Gerrit-Comment-Date: Sun, 26 Oct 2025 22:46:52 +0000
          Gerrit-HasComments: No
          Gerrit-Has-Labels: Yes
          unsatisfied_requirement
          open
          diffy

          t hepudds (Gerrit)

          unread,
          Oct 27, 2025, 12:07:01 PM (10 days ago) Oct 27
          to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com
          Attention needed from Carlo Alberto Ferraris

          t hepudds uploaded new patchset

          t hepudds uploaded patch set #48 to this change.
          Following approvals got outdated and were removed:
          • TryBots-Pass: LUCI-TryBot-Result+1 by Go LUCI
          Open in Gerrit

          Related details

          Attention is currently required from:
          • Carlo Alberto Ferraris
          Submit Requirements:
          • requirement is not satisfiedCode-Review
          • requirement is not satisfiedNo-Unresolved-Comments
          • requirement is not satisfiedReview-Enforcement
          • requirement is not satisfiedTryBots-Pass
          Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
          Gerrit-MessageType: newpatchset
          Gerrit-Project: go
          Gerrit-Branch: master
          Gerrit-Change-Id: Icceaa0f79f85c70cd1a718f9a4e7f0cf3d77803c
          Gerrit-Change-Number: 673695
          Gerrit-PatchSet: 48
          unsatisfied_requirement
          open
          diffy

          t hepudds (Gerrit)

          unread,
          Oct 27, 2025, 12:10:48 PM (10 days ago) Oct 27
          to goph...@pubsubhelper.golang.org, Go LUCI, Carlo Alberto Ferraris, golang-co...@googlegroups.com
          Attention needed from Carlo Alberto Ferraris

          t hepudds voted Commit-Queue+1

          Commit-Queue+1
          Open in Gerrit

          Related details

          Attention is currently required from:
          • Carlo Alberto Ferraris
          Submit Requirements:
          • requirement is not satisfiedCode-Review
          • requirement is not satisfiedNo-Unresolved-Comments
          • requirement is not satisfiedReview-Enforcement
          • requirement is not satisfiedTryBots-Pass
          Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
          Gerrit-MessageType: comment
          Gerrit-Project: go
          Gerrit-Branch: master
          Gerrit-Change-Id: Icceaa0f79f85c70cd1a718f9a4e7f0cf3d77803c
          Gerrit-Change-Number: 673695
          Gerrit-PatchSet: 48
          Gerrit-Owner: t hepudds <thepud...@gmail.com>
          Gerrit-Reviewer: Michael Knyszek <mkny...@google.com>
          Gerrit-Reviewer: t hepudds <thepud...@gmail.com>
          Gerrit-CC: Carlo Alberto Ferraris <carloalber...@gmail.com>
          Gerrit-Attention: Carlo Alberto Ferraris <carloalber...@gmail.com>
          Gerrit-Comment-Date: Mon, 27 Oct 2025 16:10:42 +0000
          Gerrit-HasComments: No
          Gerrit-Has-Labels: Yes
          unsatisfied_requirement
          open
          diffy

          t hepudds (Gerrit)

          unread,
          Oct 27, 2025, 2:14:28 PM (10 days ago) Oct 27
          to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com
          Attention needed from Carlo Alberto Ferraris

          t hepudds uploaded new patchset

          t hepudds uploaded patch set #49 to this change.
          Following approvals got outdated and were removed:
          • TryBots-Pass: LUCI-TryBot-Result+1 by Go LUCI
          Open in Gerrit

          Related details

          Attention is currently required from:
          • Carlo Alberto Ferraris
          Submit Requirements:
          • requirement is not satisfiedCode-Review
          • requirement is not satisfiedNo-Unresolved-Comments
          • requirement is not satisfiedReview-Enforcement
          • requirement is not satisfiedTryBots-Pass
          Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
          Gerrit-MessageType: newpatchset
          Gerrit-Project: go
          Gerrit-Branch: master
          Gerrit-Change-Id: Icceaa0f79f85c70cd1a718f9a4e7f0cf3d77803c
          Gerrit-Change-Number: 673695
          Gerrit-PatchSet: 49
          unsatisfied_requirement
          open
          diffy

          t hepudds (Gerrit)

          unread,
          Oct 27, 2025, 2:15:52 PM (10 days ago) Oct 27
          to goph...@pubsubhelper.golang.org, Go LUCI, Michael Knyszek, Carlo Alberto Ferraris, golang-co...@googlegroups.com
          Attention needed from Carlo Alberto Ferraris and Michael Knyszek

          t hepudds added 7 comments

          File src/runtime/malloc.go
          Line 998, Patchset 44:// some of which are very expensive and would never be on by default.
          Michael Knyszek . resolved

          this is already true of doubleCheckMalloc, I think reusing doubleCheckMalloc instead of a new one is fine.

          t hepudds

          Having this `doubleCheckMallocExtended` here was pretty handy when doing initial runtime.free development because it made it more convenient to flip on the ~4 function-local `doubleCheck` consts in mbitmap.go from one spot here.

          That said, happy to delete `doubleCheckMallocExtended ` now. (I left a parenthetical to remind myself and maybe other external contributors about the existence of the other ones.)

          Line 1301, Patchset 44: if !c.hasReusableNoscan(spc) {
          Michael Knyszek . unresolved

          I think I would prefer this inverted. so, rather than moving around the old code, we make this the special path. it might also be worthwhile to put all that new stuff into its own function; I am slightly worried about making this function too big and have icache problems in the no reuse case.

          with reuse we're already winning. IMO it's OK if we incur the cost of an extra function call.

          t hepudds

          Inverted as suggested. For pulling into a new function, for now I left that as a TODO and will leave this Gerrit comment unresolved for now.

          Michael Knyszek . resolved

          these debug constants are pretty granular. I understand wanting to avoid log spam (so debugReusableLog seems fine), but maybe the others can be grouped together?

          t hepudds

          Done

          Line 1914, Patchset 44: // TODO(thepudds): no-op for now for scan. Implemented in later CL in stack.
          Michael Knyszek . resolved

          throw here maybe, for now?

          t hepudds

          Done

          Line 2049, Patchset 44:
          //go:linkname strings_freeSized strings.runtimefreesized
          func strings_freeSized(p unsafe.Pointer, size uintptr, noscan bool) bool {
          return freeSized(p, size, noscan)
          }
          Michael Knyszek . resolved

          I would leave this out of this CL. I'm not yet totally sold on having stdlib call this API directly.

          t hepudds

          Done

          File src/runtime/mcache.go
          Line 110, Patchset 44: // Clear reusable slots.
          // TODO(thepudds): is this needed? Probably not, probably allocated zeroed, but confirm.
          for i := range c.reusableNoscan {
          c.reusableNoscan[i] = 0
          }
          Michael Knyszek . resolved

          you can drop this

          t hepudds

          Done

          Line 343, Patchset 44: for i := range c.reusableNoscan {
          // For noscan objects, the nodes of the linked lists are the resusable heap objects themselves,
          // so we can simply clear the linked list head pointers.
          c.reusableNoscan[i] = 0
          }
          Michael Knyszek . resolved

          nit: `clear(c.reusableNoscan[:])`

          t hepudds

          Done

          Open in Gerrit

          Related details

          Attention is currently required from:
          • Carlo Alberto Ferraris
          • Michael Knyszek
          Submit Requirements:
          • requirement is not satisfiedCode-Review
          • requirement is not satisfiedNo-Unresolved-Comments
          • requirement is not satisfiedReview-Enforcement
          • requirement is not satisfiedTryBots-Pass
          Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
          Gerrit-MessageType: comment
          Gerrit-Project: go
          Gerrit-Branch: master
          Gerrit-Change-Id: Icceaa0f79f85c70cd1a718f9a4e7f0cf3d77803c
          Gerrit-Change-Number: 673695
          Gerrit-PatchSet: 49
          Gerrit-Owner: t hepudds <thepud...@gmail.com>
          Gerrit-Reviewer: Michael Knyszek <mkny...@google.com>
          Gerrit-Reviewer: t hepudds <thepud...@gmail.com>
          Gerrit-CC: Carlo Alberto Ferraris <carloalber...@gmail.com>
          Gerrit-Attention: Carlo Alberto Ferraris <carloalber...@gmail.com>
          Gerrit-Attention: Michael Knyszek <mkny...@google.com>
          Gerrit-Comment-Date: Mon, 27 Oct 2025 18:15:47 +0000
          Gerrit-HasComments: Yes
          Gerrit-Has-Labels: No
          Comment-In-Reply-To: Michael Knyszek <mkny...@google.com>
          unsatisfied_requirement
          open
          diffy

          t hepudds (Gerrit)

          unread,
          Oct 27, 2025, 2:15:59 PM (10 days ago) Oct 27
          to goph...@pubsubhelper.golang.org, Go LUCI, Michael Knyszek, Carlo Alberto Ferraris, golang-co...@googlegroups.com
          Attention needed from Carlo Alberto Ferraris and Michael Knyszek

          t hepudds voted Commit-Queue+1

          Commit-Queue+1
          Gerrit-Comment-Date: Mon, 27 Oct 2025 18:15:54 +0000
          Gerrit-HasComments: No
          Gerrit-Has-Labels: Yes
          unsatisfied_requirement
          open
          diffy

          t hepudds (Gerrit)

          unread,
          Oct 28, 2025, 2:59:34 PM (9 days ago) Oct 28
          to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com
          Attention needed from Carlo Alberto Ferraris and Michael Knyszek

          t hepudds uploaded new patchset

          t hepudds uploaded patch set #50 to this change.
          Following approvals got outdated and were removed:
          • TryBots-Pass: LUCI-TryBot-Result+1 by Go LUCI
          Open in Gerrit

          Related details

          Attention is currently required from:
          • Carlo Alberto Ferraris
          • Michael Knyszek
          Submit Requirements:
          • requirement is not satisfiedCode-Review
          • requirement is not satisfiedNo-Unresolved-Comments
          • requirement is not satisfiedReview-Enforcement
          • requirement is not satisfiedTryBots-Pass
          Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
          Gerrit-MessageType: newpatchset
          Gerrit-Project: go
          Gerrit-Branch: master
          Gerrit-Change-Id: Icceaa0f79f85c70cd1a718f9a4e7f0cf3d77803c
          Gerrit-Change-Number: 673695
          Gerrit-PatchSet: 50
          unsatisfied_requirement
          open
          diffy

          t hepudds (Gerrit)

          unread,
          Oct 28, 2025, 3:02:00 PM (9 days ago) Oct 28
          to goph...@pubsubhelper.golang.org, Go LUCI, Michael Knyszek, Carlo Alberto Ferraris, golang-co...@googlegroups.com
          Attention needed from Carlo Alberto Ferraris and Michael Knyszek

          t hepudds voted Commit-Queue+1

          Commit-Queue+1
          Open in Gerrit

          Related details

          Attention is currently required from:
          • Carlo Alberto Ferraris
          • Michael Knyszek
          Submit Requirements:
          • requirement is not satisfiedCode-Review
          • requirement is not satisfiedNo-Unresolved-Comments
          • requirement is not satisfiedReview-Enforcement
          • requirement is not satisfiedTryBots-Pass
          Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
          Gerrit-MessageType: comment
          Gerrit-Project: go
          Gerrit-Branch: master
          Gerrit-Change-Id: Icceaa0f79f85c70cd1a718f9a4e7f0cf3d77803c
          Gerrit-Change-Number: 673695
          Gerrit-PatchSet: 50
          Gerrit-Owner: t hepudds <thepud...@gmail.com>
          Gerrit-Reviewer: Michael Knyszek <mkny...@google.com>
          Gerrit-Reviewer: t hepudds <thepud...@gmail.com>
          Gerrit-CC: Carlo Alberto Ferraris <carloalber...@gmail.com>
          Gerrit-Attention: Carlo Alberto Ferraris <carloalber...@gmail.com>
          Gerrit-Attention: Michael Knyszek <mkny...@google.com>
          Gerrit-Comment-Date: Tue, 28 Oct 2025 19:01:48 +0000
          Gerrit-HasComments: No
          Gerrit-Has-Labels: Yes
          unsatisfied_requirement
          open
          diffy

          t hepudds (Gerrit)

          unread,
          Oct 28, 2025, 3:28:12 PM (9 days ago) Oct 28
          to goph...@pubsubhelper.golang.org, Go LUCI, Michael Knyszek, Carlo Alberto Ferraris, golang-co...@googlegroups.com
          Attention needed from Carlo Alberto Ferraris and Michael Knyszek

          t hepudds added 1 comment

          File src/runtime/malloc.go
          Line 1301, Patchset 44: if !c.hasReusableNoscan(spc) {
          Michael Knyszek . resolved

          I think I would prefer this inverted. so, rather than moving around the old code, we make this the special path. it might also be worthwhile to put all that new stuff into its own function; I am slightly worried about making this function too big and have icache problems in the no reuse case.

          with reuse we're already winning. IMO it's OK if we incur the cost of an extra function call.

          t hepudds

          Inverted as suggested. For pulling into a new function, for now I left that as a TODO and will leave this Gerrit comment unresolved for now.

          t hepudds

          Pulling out a function is now done.

          Open in Gerrit

          Related details

          Attention is currently required from:
          • Carlo Alberto Ferraris
          • Michael Knyszek
          Submit Requirements:
            • requirement is not satisfiedCode-Review
            • requirement satisfiedNo-Unresolved-Comments
            • requirement is not satisfiedReview-Enforcement
            • requirement satisfiedTryBots-Pass
            Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
            Gerrit-MessageType: comment
            Gerrit-Project: go
            Gerrit-Branch: master
            Gerrit-Change-Id: Icceaa0f79f85c70cd1a718f9a4e7f0cf3d77803c
            Gerrit-Change-Number: 673695
            Gerrit-PatchSet: 50
            Gerrit-Owner: t hepudds <thepud...@gmail.com>
            Gerrit-Reviewer: Michael Knyszek <mkny...@google.com>
            Gerrit-Reviewer: t hepudds <thepud...@gmail.com>
            Gerrit-CC: Carlo Alberto Ferraris <carloalber...@gmail.com>
            Gerrit-Attention: Carlo Alberto Ferraris <carloalber...@gmail.com>
            Gerrit-Attention: Michael Knyszek <mkny...@google.com>
            Gerrit-Comment-Date: Tue, 28 Oct 2025 19:28:09 +0000
            Gerrit-HasComments: Yes
            Gerrit-Has-Labels: No
            Comment-In-Reply-To: t hepudds <thepud...@gmail.com>
            Comment-In-Reply-To: Michael Knyszek <mkny...@google.com>
            unsatisfied_requirement
            satisfied_requirement
            open
            diffy

            Michael Knyszek (Gerrit)

            unread,
            Oct 31, 2025, 12:36:16 PM (6 days ago) Oct 31
            to t hepudds, goph...@pubsubhelper.golang.org, Go LUCI, Carlo Alberto Ferraris, golang-co...@googlegroups.com
            Attention needed from Carlo Alberto Ferraris and t hepudds

            Michael Knyszek added 13 comments

            File src/runtime/malloc.go
            Line 1419, Patchset 50 (Latest): if c.hasReusableNoscan(spc) {
            Michael Knyszek . unresolved

            is this used frequently in follow-up CLs? if not, I think inlining the function here can be helpful to readers in understanding that this is only used if the GOEXPERIMENT is enabled.

            Line 1421, Patchset 50 (Latest): x := mallocgcSmallNoscanReuse(c, span, spc, size, needzero)
            Michael Knyszek . unresolved

            I think we also need to add this to the mallocgc stubs for size-specialized malloc. right now, this will never fire for allocations that skip the mallocgc entrypoint and go straight to a size-specialized malloc.

            Line 1496, Patchset 50 (Latest): // TODO(thepudds): confirm / test that is correct and the math works out, including when there's internal fragmentation.
            Michael Knyszek . unresolved

            maybe a simple way to check this is to make sure that repeated alloc/free of the same size class results in a net zero change to the G's assist credit. this should be doable from the runtime tests if you add an export_test function to get this value from the current G.

            this is optional though, just leaving this here since the TODO suggest you might be worried about it. :) I think the logic here is right, but you're right that it is a little far away from the deductAssistCredit call.

            Line 1504, Patchset 50 (Latest): // See publicationBarrier comment in mallocgcSmallNoscan.
            Michael Knyszek . resolved

            it just occurred to me -- if the caller zeroes the memory, is *it* executing a publication barrier? if not, it may be possible to observe non-zero memory during a race.

            I think this is *probably* not a real problem, and definitely not for fixing in this CL.

            Line 1508, Patchset 50 (Latest): // Note that we do not update span.freeIndexForScan, profiling info,
            Michael Knyszek . unresolved

            this is slightly concerning to me in how it will affect the resulting profile. we may need to process/detach any profiling specials on free and resample on new ones to get an accurate result. unfortunately, detaching the profiling special would likely be very expensive, currently.

            we really need a better specials system, and for a number of reasons, not just this.

            I think this current approach is fine for a disabled-by-default GOEXPERIMENT, but I think we need to resolve this before switching the default.

            please leave a comment/TODO about this here.

            Line 1916, Patchset 50 (Latest):// freeSized must be called by the effective owner of ptr who knows
            Michael Knyszek . unresolved

            p? or change the argument name to ptr.

            Line 1918, Patchset 50 (Latest):// be used past that moment. The intended callers are
            Michael Knyszek . unresolved

            maybe "In other words, ptr must be the last and only pointer to its referent."

            Line 1918, Patchset 50 (Latest):// be used past that moment. The intended callers are
            // a limited number of places in the standard library (e.g., strings.Builder)
            // or the runtime (e.g., maps grow/split code, append-handling
            // code). In the future, the compiler could also insert direct freeSized calls,
            // though currently a related API freeTracked serves that purpose.
            Michael Knyszek . unresolved

            I think you can just say "the intended caller is the compiler" for now. we can expand this as new callsites are added.

            Line 1924, Patchset 50 (Latest):// freeSized is a no-op if called on a stack pointer. It must not be called
            Michael Knyszek . unresolved

            "pointer into a stack" maybe?

            Line 1932, Patchset 50 (Latest):// If the size of ptr's object is less than or equal to 16 bytes or
            // greater than 32KiB bytes, freeSized is currently a no-op. It must only
            // be called in alloc-safe places.
            Michael Knyszek . unresolved

            maybe also say it currently crashes if noscan is false?

            Line 1962, Patchset 50 (Latest): // This pointer is on the stack, so free is a no-op.
            Michael Knyszek . unresolved

            "points into our stack" maybe?

            Line 1969, Patchset 50 (Latest): // TODO(thepudds): we could enforce no free on globals in bss or data. Maybe by checking span via spanOf
            Michael Knyszek . unresolved

            high-level comment: we generally don't care about line length, except this is frequently causing wrap-around in Gerrit for me which makes it a bit harder to review. :) if you could shrink the line length a bit, I would appreciate it.

            Line 2043, Patchset 50 (Latest): // TODO(thepudds): is something like this KeepAlive needed? For freeSized, we want
            // the pointer to be alive, though I don't know if we need the KeepAlive here.
            // (For freeTracked, we don't keep the pointer alive).
            KeepAlive(p)
            Michael Knyszek . unresolved

            I think it is not needed. if it is dead, that's OK. the important part is a GC transition cannot occur while we're in this function, since we're non-preemptible. I think you can remove this and add a comment to that effect.

            Open in Gerrit

            Related details

            Attention is currently required from:
            • Carlo Alberto Ferraris
            • t hepudds
            Submit Requirements:
              • requirement is not satisfiedCode-Review
              • requirement is not satisfiedNo-Unresolved-Comments
              • requirement is not satisfiedReview-Enforcement
              • requirement satisfiedTryBots-Pass
              Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
              Gerrit-MessageType: comment
              Gerrit-Project: go
              Gerrit-Branch: master
              Gerrit-Change-Id: Icceaa0f79f85c70cd1a718f9a4e7f0cf3d77803c
              Gerrit-Change-Number: 673695
              Gerrit-PatchSet: 50
              Gerrit-Owner: t hepudds <thepud...@gmail.com>
              Gerrit-Reviewer: Michael Knyszek <mkny...@google.com>
              Gerrit-Reviewer: t hepudds <thepud...@gmail.com>
              Gerrit-CC: Carlo Alberto Ferraris <carloalber...@gmail.com>
              Gerrit-Attention: t hepudds <thepud...@gmail.com>
              Gerrit-Attention: Carlo Alberto Ferraris <carloalber...@gmail.com>
              Gerrit-Comment-Date: Fri, 31 Oct 2025 16:36:12 +0000
              Gerrit-HasComments: Yes
              Gerrit-Has-Labels: No
              unsatisfied_requirement
              satisfied_requirement
              open
              diffy

              Michael Knyszek (Gerrit)

              unread,
              Oct 31, 2025, 12:41:45 PM (6 days ago) Oct 31
              to t hepudds, goph...@pubsubhelper.golang.org, Go LUCI, Carlo Alberto Ferraris, golang-co...@googlegroups.com
              Attention needed from Carlo Alberto Ferraris and t hepudds

              Michael Knyszek added 1 comment

              File src/runtime/malloc.go
              Line 1421, Patchset 50 (Latest): x := mallocgcSmallNoscanReuse(c, span, spc, size, needzero)
              Michael Knyszek . resolved

              I think we also need to add this to the mallocgc stubs for size-specialized malloc. right now, this will never fire for allocations that skip the mallocgc entrypoint and go straight to a size-specialized malloc.

              Michael Knyszek

              oops! I see you do this in a follow-up.

              Gerrit-Comment-Date: Fri, 31 Oct 2025 16:41:41 +0000
              Gerrit-HasComments: Yes
              Gerrit-Has-Labels: No
              Comment-In-Reply-To: Michael Knyszek <mkny...@google.com>
              unsatisfied_requirement
              satisfied_requirement
              open
              diffy

              Michael Knyszek (Gerrit)

              unread,
              Oct 31, 2025, 1:02:11 PM (6 days ago) Oct 31
              to t hepudds, goph...@pubsubhelper.golang.org, Go LUCI, Carlo Alberto Ferraris, golang-co...@googlegroups.com
              Attention needed from Carlo Alberto Ferraris and t hepudds

              Michael Knyszek added 2 comments

              File src/runtime/malloc_test.go
              Line 345, Patchset 50 (Latest): // no allocs get reported. (Again, not the desired long-term behavior).
              Michael Knyszek . unresolved

              ah, we should add a TODO to update alloc/free stats, which currently don't move. I don't remember seeing one, so putting a reminder in freeSize and in the Reuse functions would be helpful.

              Line 384, Patchset 50 (Latest): // The remaining tests below here are more expensive currently.
              Michael Knyszek . unresolved

              how long are these tests? maybe skip if testing.Short()?

              Gerrit-Comment-Date: Fri, 31 Oct 2025 17:01:50 +0000
              Gerrit-HasComments: Yes
              Gerrit-Has-Labels: No
              unsatisfied_requirement
              satisfied_requirement
              open
              diffy

              Michael Knyszek (Gerrit)

              unread,
              Oct 31, 2025, 1:04:22 PM (6 days ago) Oct 31
              to t hepudds, goph...@pubsubhelper.golang.org, Go LUCI, Carlo Alberto Ferraris, golang-co...@googlegroups.com
              Attention needed from Carlo Alberto Ferraris and t hepudds

              Michael Knyszek added 1 comment

              File src/runtime/malloc.go
              Line 1496, Patchset 50 (Latest): // TODO(thepudds): confirm / test that is correct and the math works out, including when there's internal fragmentation.
              Michael Knyszek . unresolved

              maybe a simple way to check this is to make sure that repeated alloc/free of the same size class results in a net zero change to the G's assist credit. this should be doable from the runtime tests if you add an export_test function to get this value from the current G.

              this is optional though, just leaving this here since the TODO suggest you might be worried about it. :) I think the logic here is right, but you're right that it is a little far away from the deductAssistCredit call.

              Michael Knyszek

              actually yeah, after reviewing the follow-up CL, I recalled that the update to the assist credit is actually split inside mallocgc. I think a test here is a great idea. we have 3 updates, and none of them are close to each other.

              Gerrit-Comment-Date: Fri, 31 Oct 2025 17:04:17 +0000
              Gerrit-HasComments: Yes
              Gerrit-Has-Labels: No
              Comment-In-Reply-To: Michael Knyszek <mkny...@google.com>
              unsatisfied_requirement
              satisfied_requirement
              open
              diffy

              t hepudds (Gerrit)

              unread,
              Nov 3, 2025, 4:48:29 PM (3 days ago) Nov 3
              to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com
              Attention needed from Carlo Alberto Ferraris and t hepudds

              t hepudds uploaded new patchset

              t hepudds uploaded patch set #51 to this change.
              Following approvals got outdated and were removed:
              • TryBots-Pass: LUCI-TryBot-Result+1 by Go LUCI

              Related details

              Attention is currently required from:
              • Carlo Alberto Ferraris
              • t hepudds
              Submit Requirements:
                • requirement is not satisfiedCode-Review
                • requirement is not satisfiedNo-Unresolved-Comments
                • requirement is not satisfiedReview-Enforcement
                • requirement is not satisfiedTryBots-Pass
                Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
                Gerrit-MessageType: newpatchset
                Gerrit-Project: go
                Gerrit-Branch: master
                Gerrit-Change-Id: Icceaa0f79f85c70cd1a718f9a4e7f0cf3d77803c
                Gerrit-Change-Number: 673695
                Gerrit-PatchSet: 51
                unsatisfied_requirement
                open
                diffy

                t hepudds (Gerrit)

                unread,
                Nov 3, 2025, 6:40:25 PM (2 days ago) Nov 3
                to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com
                Attention needed from Carlo Alberto Ferraris and t hepudds

                t hepudds uploaded new patchset

                t hepudds uploaded patch set #52 to this change.
                Open in Gerrit

                Related details

                Attention is currently required from:
                • Carlo Alberto Ferraris
                • t hepudds
                Submit Requirements:
                • requirement is not satisfiedCode-Review
                • requirement is not satisfiedNo-Unresolved-Comments
                • requirement is not satisfiedReview-Enforcement
                • requirement is not satisfiedTryBots-Pass
                Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
                Gerrit-MessageType: newpatchset
                Gerrit-Project: go
                Gerrit-Branch: master
                Gerrit-Change-Id: Icceaa0f79f85c70cd1a718f9a4e7f0cf3d77803c
                Gerrit-Change-Number: 673695
                Gerrit-PatchSet: 52
                unsatisfied_requirement
                open
                diffy

                t hepudds (Gerrit)

                unread,
                Nov 3, 2025, 9:00:39 PM (2 days ago) Nov 3
                to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com
                Attention needed from Carlo Alberto Ferraris and t hepudds

                t hepudds uploaded new patchset

                t hepudds uploaded patch set #53 to this change.
                Open in Gerrit

                Related details

                Attention is currently required from:
                • Carlo Alberto Ferraris
                • t hepudds
                Submit Requirements:
                • requirement is not satisfiedCode-Review
                • requirement is not satisfiedNo-Unresolved-Comments
                • requirement is not satisfiedReview-Enforcement
                • requirement is not satisfiedTryBots-Pass
                Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
                Gerrit-MessageType: newpatchset
                Gerrit-Project: go
                Gerrit-Branch: master
                Gerrit-Change-Id: Icceaa0f79f85c70cd1a718f9a4e7f0cf3d77803c
                Gerrit-Change-Number: 673695
                Gerrit-PatchSet: 53
                unsatisfied_requirement
                open
                diffy

                t hepudds (Gerrit)

                unread,
                Nov 4, 2025, 1:08:39 PM (2 days ago) Nov 4
                to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com
                Attention needed from Carlo Alberto Ferraris and t hepudds

                t hepudds uploaded new patchset

                t hepudds uploaded patch set #54 to this change.
                Open in Gerrit

                Related details

                Attention is currently required from:
                • Carlo Alberto Ferraris
                • t hepudds
                Submit Requirements:
                • requirement is not satisfiedCode-Review
                • requirement is not satisfiedNo-Unresolved-Comments
                • requirement is not satisfiedReview-Enforcement
                • requirement is not satisfiedTryBots-Pass
                Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
                Gerrit-MessageType: newpatchset
                Gerrit-Project: go
                Gerrit-Branch: master
                Gerrit-Change-Id: Icceaa0f79f85c70cd1a718f9a4e7f0cf3d77803c
                Gerrit-Change-Number: 673695
                Gerrit-PatchSet: 54
                unsatisfied_requirement
                open
                diffy

                t hepudds (Gerrit)

                unread,
                Nov 4, 2025, 2:59:39 PM (2 days ago) Nov 4
                to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com
                Attention needed from Carlo Alberto Ferraris and t hepudds

                t hepudds uploaded new patchset

                t hepudds uploaded patch set #55 to this change.
                Open in Gerrit

                Related details

                Attention is currently required from:
                • Carlo Alberto Ferraris
                • t hepudds
                Submit Requirements:
                • requirement is not satisfiedCode-Review
                • requirement is not satisfiedNo-Unresolved-Comments
                • requirement is not satisfiedReview-Enforcement
                • requirement is not satisfiedTryBots-Pass
                Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
                Gerrit-MessageType: newpatchset
                Gerrit-Project: go
                Gerrit-Branch: master
                Gerrit-Change-Id: Icceaa0f79f85c70cd1a718f9a4e7f0cf3d77803c
                Gerrit-Change-Number: 673695
                Gerrit-PatchSet: 55
                unsatisfied_requirement
                open
                diffy

                t hepudds (Gerrit)

                unread,
                Nov 4, 2025, 3:16:19 PM (2 days ago) Nov 4
                to goph...@pubsubhelper.golang.org, Go LUCI, Carlo Alberto Ferraris, golang-co...@googlegroups.com
                Attention needed from Carlo Alberto Ferraris

                t hepudds voted Commit-Queue+1

                Commit-Queue+1
                Open in Gerrit

                Related details

                Attention is currently required from:
                • Carlo Alberto Ferraris
                Submit Requirements:
                • requirement is not satisfiedCode-Review
                • requirement is not satisfiedNo-Unresolved-Comments
                • requirement is not satisfiedReview-Enforcement
                • requirement is not satisfiedTryBots-Pass
                Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
                Gerrit-MessageType: comment
                Gerrit-Project: go
                Gerrit-Branch: master
                Gerrit-Change-Id: Icceaa0f79f85c70cd1a718f9a4e7f0cf3d77803c
                Gerrit-Change-Number: 673695
                Gerrit-PatchSet: 55
                Gerrit-Owner: t hepudds <thepud...@gmail.com>
                Gerrit-Reviewer: Michael Knyszek <mkny...@google.com>
                Gerrit-Reviewer: t hepudds <thepud...@gmail.com>
                Gerrit-CC: Carlo Alberto Ferraris <carloalber...@gmail.com>
                Gerrit-Attention: Carlo Alberto Ferraris <carloalber...@gmail.com>
                Gerrit-Comment-Date: Tue, 04 Nov 2025 20:16:15 +0000
                Gerrit-HasComments: No
                Gerrit-Has-Labels: Yes
                unsatisfied_requirement
                open
                diffy

                t hepudds (Gerrit)

                unread,
                Nov 4, 2025, 3:39:09 PM (2 days ago) Nov 4
                to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com
                Attention needed from Carlo Alberto Ferraris

                t hepudds uploaded new patchset

                t hepudds uploaded patch set #56 to this change.
                Open in Gerrit

                Related details

                Attention is currently required from:
                • Carlo Alberto Ferraris
                Submit Requirements:
                  • requirement is not satisfiedCode-Review
                  • requirement is not satisfiedNo-Unresolved-Comments
                  • requirement is not satisfiedReview-Enforcement
                  • requirement satisfiedTryBots-Pass
                  Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
                  Gerrit-MessageType: newpatchset
                  Gerrit-Project: go
                  Gerrit-Branch: master
                  Gerrit-Change-Id: Icceaa0f79f85c70cd1a718f9a4e7f0cf3d77803c
                  Gerrit-Change-Number: 673695
                  Gerrit-PatchSet: 56
                  unsatisfied_requirement
                  satisfied_requirement
                  open
                  diffy

                  t hepudds (Gerrit)

                  unread,
                  Nov 4, 2025, 3:41:33 PM (2 days ago) Nov 4
                  to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com
                  Attention needed from Carlo Alberto Ferraris

                  t hepudds uploaded new patchset

                  t hepudds uploaded patch set #57 to this change.
                  Open in Gerrit

                  Related details

                  Attention is currently required from:
                  • Carlo Alberto Ferraris
                  Submit Requirements:
                  • requirement is not satisfiedCode-Review
                  • requirement is not satisfiedNo-Unresolved-Comments
                  • requirement is not satisfiedReview-Enforcement
                  • requirement satisfiedTryBots-Pass
                  Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
                  Gerrit-MessageType: newpatchset
                  Gerrit-Project: go
                  Gerrit-Branch: master
                  Gerrit-Change-Id: Icceaa0f79f85c70cd1a718f9a4e7f0cf3d77803c
                  Gerrit-Change-Number: 673695
                  Gerrit-PatchSet: 57
                  unsatisfied_requirement
                  satisfied_requirement
                  open
                  diffy

                  t hepudds (Gerrit)

                  unread,
                  Nov 4, 2025, 4:04:08 PM (2 days ago) Nov 4
                  to goph...@pubsubhelper.golang.org, Go LUCI, Michael Knyszek, Carlo Alberto Ferraris, golang-co...@googlegroups.com
                  Attention needed from Carlo Alberto Ferraris and Michael Knyszek

                  t hepudds added 13 comments

                  File src/runtime/malloc.go
                  Line 1419, Patchset 50: if c.hasReusableNoscan(spc) {
                  Michael Knyszek . resolved

                  is this used frequently in follow-up CLs? if not, I think inlining the function here can be helpful to readers in understanding that this is only used if the GOEXPERIMENT is enabled.

                  t hepudds
                  Above, I added a new `runtimeFreegcEnabled` const, which follows the naming convention of the new-ish `sizeSpecializedMallocEnabled` const.

                  Here, I added a a check against that `runtimeFreegcEnabled`, which I think does help a reader know this branch is less interesting if runtime.freegc support is not enabled.

                  (I did not inline the whole function because `hasReusableNoscan` and the `hasReusable*` variants introduced in a later CL for !noscan support have changed a few times, and it also helps minimize how much needs to be duplicated into the malloc_stubs.go in a later CL. Hope that makes sense to you; happy to revisit if not).

                  Line 1496, Patchset 50: // TODO(thepudds): confirm / test that is correct and the math works out, including when there's internal fragmentation.
                  Michael Knyszek . resolved

                  maybe a simple way to check this is to make sure that repeated alloc/free of the same size class results in a net zero change to the G's assist credit. this should be doable from the runtime tests if you add an export_test function to get this value from the current G.

                  this is optional though, just leaving this here since the TODO suggest you might be worried about it. :) I think the logic here is right, but you're right that it is a little far away from the deductAssistCredit call.

                  Michael Knyszek

                  actually yeah, after reviewing the follow-up CL, I recalled that the update to the assist credit is actually split inside mallocgc. I think a test here is a great idea. we have 3 updates, and none of them are close to each other.

                  t hepudds

                  That was a great suggestion to add that test. I was in fact missing a conditional check in the allocation credit handling here, which I've resolved now here (hopefully).

                  Making the test work was a little subtle and more complicated than simply doing some bracketed measurements, so I sent it as a separate CL 717520 to make it easier to review/discuss, currently immediately following this one in the stack. (And maybe you will point out a simpler testing approach, and then maybe it won't be subtle any longer).

                  Line 1508, Patchset 50: // Note that we do not update span.freeIndexForScan, profiling info,
                  Michael Knyszek . resolved

                  this is slightly concerning to me in how it will affect the resulting profile. we may need to process/detach any profiling specials on free and resample on new ones to get an accurate result. unfortunately, detaching the profiling special would likely be very expensive, currently.

                  we really need a better specials system, and for a number of reasons, not just this.

                  I think this current approach is fine for a disabled-by-default GOEXPERIMENT, but I think we need to resolve this before switching the default.

                  please leave a comment/TODO about this here.

                  t hepudds

                  Done

                  Line 1916, Patchset 50:// freeSized must be called by the effective owner of ptr who knows
                  Michael Knyszek . resolved

                  p? or change the argument name to ptr.

                  t hepudds

                  Renamed to `ptr`.

                  Line 1918, Patchset 50:// be used past that moment. The intended callers are
                  Michael Knyszek . resolved

                  maybe "In other words, ptr must be the last and only pointer to its referent."

                  t hepudds

                  Done

                  Line 1918, Patchset 50:// be used past that moment. The intended callers are

                  // a limited number of places in the standard library (e.g., strings.Builder)
                  // or the runtime (e.g., maps grow/split code, append-handling
                  // code). In the future, the compiler could also insert direct freeSized calls,
                  // though currently a related API freeTracked serves that purpose.
                  Michael Knyszek . resolved

                  I think you can just say "the intended caller is the compiler" for now. we can expand this as new callsites are added.

                  t hepudds

                  Done

                  Line 1924, Patchset 50:// freeSized is a no-op if called on a stack pointer. It must not be called
                  Michael Knyszek . resolved

                  "pointer into a stack" maybe?

                  t hepudds

                  Done

                  Line 1932, Patchset 50:// If the size of ptr's object is less than or equal to 16 bytes or

                  // greater than 32KiB bytes, freeSized is currently a no-op. It must only
                  // be called in alloc-safe places.
                  Michael Knyszek . resolved

                  maybe also say it currently crashes if noscan is false?

                  t hepudds

                  Done

                  Line 1962, Patchset 50: // This pointer is on the stack, so free is a no-op.
                  Michael Knyszek . resolved

                  "points into our stack" maybe?

                  t hepudds

                  Done

                  Line 1969, Patchset 50: // TODO(thepudds): we could enforce no free on globals in bss or data. Maybe by checking span via spanOf
                  Michael Knyszek . resolved

                  high-level comment: we generally don't care about line length, except this is frequently causing wrap-around in Gerrit for me which makes it a bit harder to review. :) if you could shrink the line length a bit, I would appreciate it.

                  t hepudds

                  I wrapped this better, and took a mental note for the future.

                  (I did not revisit other places, but happy to do that if you were noticing a general issue or maybe this specific spot was just the worst offender).

                  FWIW, I tend to go wider than my norm when writing a TODO (to make more context pop out when grepping, etc.), but went too wide here.

                  Line 2043, Patchset 50: // TODO(thepudds): is something like this KeepAlive needed? For freeSized, we want

                  // the pointer to be alive, though I don't know if we need the KeepAlive here.
                  // (For freeTracked, we don't keep the pointer alive).
                  KeepAlive(p)
                  Michael Knyszek . resolved

                  I think it is not needed. if it is dead, that's OK. the important part is a GC transition cannot occur while we're in this function, since we're non-preemptible. I think you can remove this and add a comment to that effect.

                  t hepudds

                  Done

                  File src/runtime/malloc_test.go
                  Line 345, Patchset 50: // no allocs get reported. (Again, not the desired long-term behavior).
                  Michael Knyszek . resolved

                  ah, we should add a TODO to update alloc/free stats, which currently don't move. I don't remember seeing one, so putting a reminder in freeSize and in the Reuse functions would be helpful.

                  t hepudds

                  Related TODO about alloc/free stats added in mallocgcSmallNoscanReuse.

                  Line 384, Patchset 50: // The remaining tests below here are more expensive currently.
                  Michael Knyszek . unresolved

                  how long are these tests? maybe skip if testing.Short()?

                  t hepudds

                  WASM was particularly slow, and I suspect especially on the tests that create a bunch of goroutines, which are below here (but I did not investigate WASM much).

                  Setting aside WASM, I did tune the tests to be faster and to do less work when `-short` is specified, but maybe I should do another pass. Or maybe I could leave a TODO for now for this CL to tune execution time a bit more?

                  The current numbers:

                  • `gotip test -short -run=TestFreegc runtime` takes ~0.6 secs on a decent Linux VM.
                  • `gotip test -run=TestFreegc runtime` (no -short) takes ~6.5 sec on that same VM, which is probably too long.
                  Open in Gerrit

                  Related details

                  Attention is currently required from:
                  • Carlo Alberto Ferraris
                  • Michael Knyszek
                  Submit Requirements:
                  • requirement is not satisfiedCode-Review
                  • requirement is not satisfiedNo-Unresolved-Comments
                  • requirement is not satisfiedReview-Enforcement
                  • requirement satisfiedTryBots-Pass
                  Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
                  Gerrit-MessageType: comment
                  Gerrit-Project: go
                  Gerrit-Branch: master
                  Gerrit-Change-Id: Icceaa0f79f85c70cd1a718f9a4e7f0cf3d77803c
                  Gerrit-Change-Number: 673695
                  Gerrit-PatchSet: 57
                  Gerrit-Owner: t hepudds <thepud...@gmail.com>
                  Gerrit-Reviewer: Michael Knyszek <mkny...@google.com>
                  Gerrit-Reviewer: t hepudds <thepud...@gmail.com>
                  Gerrit-CC: Carlo Alberto Ferraris <carloalber...@gmail.com>
                  Gerrit-Attention: Carlo Alberto Ferraris <carloalber...@gmail.com>
                  Gerrit-Attention: Michael Knyszek <mkny...@google.com>
                  Gerrit-Comment-Date: Tue, 04 Nov 2025 21:04:04 +0000
                  unsatisfied_requirement
                  satisfied_requirement
                  open
                  diffy

                  t hepudds (Gerrit)

                  unread,
                  Nov 4, 2025, 4:04:58 PM (2 days ago) Nov 4
                  to goph...@pubsubhelper.golang.org, Go LUCI, Michael Knyszek, Carlo Alberto Ferraris, golang-co...@googlegroups.com
                  Attention needed from Carlo Alberto Ferraris and Michael Knyszek

                  t hepudds added 1 comment

                  Patchset-level comments
                  File-level comment, Patchset 57 (Latest):
                  t hepudds . resolved

                  Hi @mkny...@google.com, PTAL when convenient.

                  Gerrit-Comment-Date: Tue, 04 Nov 2025 21:04:52 +0000
                  Gerrit-HasComments: Yes
                  Gerrit-Has-Labels: No
                  unsatisfied_requirement
                  satisfied_requirement
                  open
                  diffy

                  t hepudds (Gerrit)

                  unread,
                  Nov 5, 2025, 12:52:30 PM (17 hours ago) Nov 5
                  to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com
                  Attention needed from Carlo Alberto Ferraris and Michael Knyszek

                  t hepudds uploaded new patchset

                  t hepudds uploaded patch set #58 to this change.
                  Following approvals got outdated and were removed:
                  • TryBots-Pass: LUCI-TryBot-Result+1 by Go LUCI

                  Related details

                  Attention is currently required from:
                  • Carlo Alberto Ferraris
                  • Michael Knyszek
                  Submit Requirements:
                    • requirement is not satisfiedCode-Review
                    • requirement is not satisfiedNo-Unresolved-Comments
                    • requirement is not satisfiedReview-Enforcement
                    • requirement is not satisfiedTryBots-Pass
                    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
                    Gerrit-MessageType: newpatchset
                    Gerrit-Project: go
                    Gerrit-Branch: master
                    Gerrit-Change-Id: Icceaa0f79f85c70cd1a718f9a4e7f0cf3d77803c
                    Gerrit-Change-Number: 673695
                    Gerrit-PatchSet: 58
                    unsatisfied_requirement
                    open
                    diffy

                    t hepudds (Gerrit)

                    unread,
                    Nov 5, 2025, 1:15:39 PM (17 hours ago) Nov 5
                    to goph...@pubsubhelper.golang.org, Go LUCI, Michael Knyszek, Carlo Alberto Ferraris, golang-co...@googlegroups.com
                    Attention needed from Carlo Alberto Ferraris and Michael Knyszek

                    t hepudds added 1 comment

                    File src/runtime/malloc_test.go
                    Line 384, Patchset 50: // The remaining tests below here are more expensive currently.
                    Michael Knyszek . resolved

                    how long are these tests? maybe skip if testing.Short()?

                    t hepudds

                    WASM was particularly slow, and I suspect especially on the tests that create a bunch of goroutines, which are below here (but I did not investigate WASM much).

                    Setting aside WASM, I did tune the tests to be faster and to do less work when `-short` is specified, but maybe I should do another pass. Or maybe I could leave a TODO for now for this CL to tune execution time a bit more?

                    The current numbers:

                    • `gotip test -short -run=TestFreegc runtime` takes ~0.6 secs on a decent Linux VM.
                    • `gotip test -run=TestFreegc runtime` (no -short) takes ~6.5 sec on that same VM, which is probably too long.
                    t hepudds

                    Hi @mkny...@google.com, marking this as resolved after I tuned the test execution time a little more.

                    Latest numbers for `go test -run=TestFreegc` are:

                    • if running in -short mode OR if runtime.freegc is disabled: ~0.14 sec
                    • otherwise (so not -short mode AND runtime.freegc is enabled): ~7.0 sec

                    Hopefully that's reasonable, at least for now (though of course, like everything here, happy to discuss more or tweak further if you have a different take).

                    I could also add a TODO to tune more.

                    Open in Gerrit

                    Related details

                    Attention is currently required from:
                    • Carlo Alberto Ferraris
                    • Michael Knyszek
                    Submit Requirements:
                      • requirement is not satisfiedCode-Review
                      • requirement satisfiedNo-Unresolved-Comments
                      • requirement is not satisfiedReview-Enforcement
                      • requirement satisfiedTryBots-Pass
                      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
                      Gerrit-MessageType: comment
                      Gerrit-Project: go
                      Gerrit-Branch: master
                      Gerrit-Change-Id: Icceaa0f79f85c70cd1a718f9a4e7f0cf3d77803c
                      Gerrit-Change-Number: 673695
                      Gerrit-PatchSet: 58
                      Gerrit-Owner: t hepudds <thepud...@gmail.com>
                      Gerrit-Reviewer: Michael Knyszek <mkny...@google.com>
                      Gerrit-Reviewer: t hepudds <thepud...@gmail.com>
                      Gerrit-CC: Carlo Alberto Ferraris <carloalber...@gmail.com>
                      Gerrit-Attention: Carlo Alberto Ferraris <carloalber...@gmail.com>
                      Gerrit-Attention: Michael Knyszek <mkny...@google.com>
                      Gerrit-Comment-Date: Wed, 05 Nov 2025 18:15:34 +0000
                      Gerrit-HasComments: Yes
                      Gerrit-Has-Labels: No
                      unsatisfied_requirement
                      satisfied_requirement
                      open
                      diffy
                      Reply all
                      Reply to author
                      Forward
                      0 new messages