Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exposing memory.numa_stats #2278

Merged
merged 1 commit into from
Apr 14, 2020

Conversation

iwankgb
Copy link

@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
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
Author

iwankgb commented Mar 31, 2020

@AkihiroSuda rebased :)

@AkihiroSuda
Copy link
Member

AkihiroSuda commented Apr 2, 2020

LGTM

Approved with PullApprove

@iwankgb
Copy link
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
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
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
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
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.

@@ -26,98 +25,109 @@ func blkioStatEntryEquals(expected, actual []cgroups.BlkioStatEntry) error {

func expectBlkioStatsEquals(t *testing.T, expected, actual cgroups.BlkioStats) {
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
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
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
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
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
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.

Copy link
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
Copy link
Author

iwankgb commented Apr 8, 2020

@AkihiroSuda I would appreciate one more iteration of review.

@iwankgb
Copy link
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
Member

AkihiroSuda commented Apr 14, 2020

LGTM

Approved with PullApprove

1 similar comment
@crosbymichael
Copy link
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