Skip to content

Exposing memory.numa_stats#2278

Merged
crosbymichael merged 1 commit into
opencontainers:masterfrom
iwankgb:memory.numa_stats
Apr 14, 2020
Merged

Exposing memory.numa_stats#2278
crosbymichael merged 1 commit into
opencontainers:masterfrom
iwankgb:memory.numa_stats

Conversation

@iwankgb
Copy link
Copy Markdown

@iwankgb iwankgb commented Mar 30, 2020

Making information on page usage by type and NUMA node available.

@iwankgb iwankgb mentioned this pull request Mar 30, 2020
@iwankgb iwankgb force-pushed the memory.numa_stats branch 2 times, most recently from b136fac to 8a031e3 Compare March 30, 2020 14:16
@AkihiroSuda
Copy link
Copy Markdown
Member

Code looks good, but needs rebase

@iwankgb iwankgb force-pushed the memory.numa_stats branch 2 times, most recently from 50dd50b to b93ca20 Compare March 31, 2020 08:27
@iwankgb
Copy link
Copy Markdown
Author

iwankgb commented Mar 31, 2020

@AkihiroSuda rebased :)

@AkihiroSuda
Copy link
Copy Markdown
Member

AkihiroSuda commented Apr 2, 2020

LGTM

Approved with PullApprove

@iwankgb
Copy link
Copy Markdown
Author

iwankgb commented Apr 8, 2020

@caniszczyk, @crosbymichael, @cyphar, @dqminh, @hqhq, @mrunalp, @rjnagal, @vmarmol - second opinion would be appreciated.

return cgroups.PageUsageByNUMA{}, err
}
}
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

error checking for scanner is missing here

numaStatColumnSliceLength = 2
cgroupMemorySwapLimit = "memory.memsw.limit_in_bytes"
cgroupMemoryLimit = "memory.limit_in_bytes"
cgroupMemoryPagesByNuma = "memory.numa_stat"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this available in both cgroup v1 and v2?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like it's v1-only

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't see it in v2.

if err := blkioStatEntryEquals(expected.IoServiceBytesRecursive, actual.IoServiceBytesRecursive); err != nil {
logrus.Printf("blkio IoServiceBytesRecursive do not match - %s\n", err)
t.Fail()
t.Errorf("blkio IoServiceBytesRecursive do not match - %s\n", err)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please move this cleanup out to a separate commit that goes first.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aren't all PR's commits squashed before merge anyway?

}

if isNUMANode.MatchString(pagesByNode[numaStatTypeIndex]) {
nodeID, err := strconv.ParseUint(pagesByNode[numaStatTypeIndex][1:], 10, 8)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this check can be simplified by just checking for capital N plus no error from ParseUint.

columns := strings.SplitN(scanner.Text(), numaStatColumnSeparator, numaStatMaxColumns)

for _, column := range columns {
pagesByNode := strings.SplitN(column, numaStatKeyValueSeparator, numaStatColumnSliceLength)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since numaStatKeyValueSeparator is only used once, it's better to inline it, e.g.

strings.SplitN(column, "=", 2)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All other constants are used once, I think. I still prefer them than magic strings.

Comment thread libcontainer/cgroups/fs/memory.go Outdated
Copy link
Copy Markdown
Contributor

@kolyshkin kolyshkin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

left some comments

Making information on page usage by type and NUMA node available

Signed-off-by: Maciej "Iwan" Iwanowski <maciej.iwanowski@intel.com>
@iwankgb iwankgb force-pushed the memory.numa_stats branch from b93ca20 to 7fe0a98 Compare April 8, 2020 15:43
@iwankgb
Copy link
Copy Markdown
Author

iwankgb commented Apr 8, 2020

@AkihiroSuda I would appreciate one more iteration of review.

@iwankgb
Copy link
Copy Markdown
Author

iwankgb commented Apr 9, 2020

Travis build succeeded but status has not been reported: https://travis-ci.org/github/opencontainers/runc/builds/672578771.

@AkihiroSuda
Copy link
Copy Markdown
Member

AkihiroSuda commented Apr 14, 2020

LGTM

Approved with PullApprove

1 similar comment
@crosbymichael
Copy link
Copy Markdown
Member

crosbymichael commented Apr 14, 2020

LGTM

Approved with PullApprove

@crosbymichael crosbymichael merged commit 5c6216b into opencontainers:master Apr 14, 2020
@iwankgb iwankgb deleted the memory.numa_stats branch April 14, 2020 16:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants