diff options
| author | qiulaidongfeng <2645477756@qq.com> | 2023-10-10 12:43:40 +0000 |
|---|---|---|
| committer | Keith Randall <khr@golang.org> | 2023-10-24 20:28:25 +0000 |
| commit | b5f87b5407916c4049a3158cc944cebfd7a883a9 (patch) | |
| tree | 64b4a4c47ee017cad96b8b908ba368ee966ecdf1 /src/runtime/mpagealloc.go | |
| parent | 9ab5121691ee0c4f32bf8d8c3c10c0e85a89ceb5 (diff) | |
| download | go-b5f87b5407916c4049a3158cc944cebfd7a883a9.tar.xz | |
runtime: use max/min func
Change-Id: I3f0b7209621b39cee69566a5cc95e4343b4f1f20
GitHub-Last-Rev: af9dbbe69ad74e8c210254dafa260a886b690853
GitHub-Pull-Request: golang/go#63321
Reviewed-on: https://go-review.googlesource.com/c/go/+/531916
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Mauri de Souza Meneguzzo <mauri870@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Diffstat (limited to 'src/runtime/mpagealloc.go')
| -rw-r--r-- | src/runtime/mpagealloc.go | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/src/runtime/mpagealloc.go b/src/runtime/mpagealloc.go index 3e789ab85c..f87565417f 100644 --- a/src/runtime/mpagealloc.go +++ b/src/runtime/mpagealloc.go @@ -1038,8 +1038,8 @@ func mergeSummaries(sums []pallocSum, logMaxPagesPerSum uint) pallocSum { // Merge the summaries in sums into one. // // We do this by keeping a running summary representing the merged - // summaries of sums[:i] in start, max, and end. - start, max, end := sums[0].unpack() + // summaries of sums[:i] in start, most, and end. + start, most, end := sums[0].unpack() for i := 1; i < len(sums); i++ { // Merge in sums[i]. si, mi, ei := sums[i].unpack() @@ -1055,12 +1055,7 @@ func mergeSummaries(sums []pallocSum, logMaxPagesPerSum uint) pallocSum { // across the boundary between the running sum and sums[i] // and at the max sums[i], taking the greatest of those two // and the max of the running sum. - if end+si > max { - max = end + si - } - if mi > max { - max = mi - } + most = max(most, end+si, mi) // Merge in end by checking if this new summary is totally // free. If it is, then we want to extend the running sum's @@ -1073,5 +1068,5 @@ func mergeSummaries(sums []pallocSum, logMaxPagesPerSum uint) pallocSum { end = ei } } - return packPallocSum(start, max, end) + return packPallocSum(start, most, end) } |
