components/golang-17/patches/0015-release-branch.go1.7-runtime-fix-check-for-vacuous-p.patch
changeset 7518 c388d4e1d3ad
equal deleted inserted replaced
7517:42ae3923b8fe 7518:c388d4e1d3ad
       
     1 From 40712a962573a9ad987c71ba2cb24e6d430b559d Mon Sep 17 00:00:00 2001
       
     2 From: Austin Clements <[email protected]>
       
     3 Date: Fri, 19 Aug 2016 16:03:14 -0400
       
     4 Subject: [PATCH 15/38] [release-branch.go1.7] runtime: fix check for vacuous
       
     5  page boundary rounding again
       
     6 
       
     7 The previous fix for this, commit 336dad2a, had everything right in
       
     8 the commit message, but reversed the test in the code. Fix the test in
       
     9 the code.
       
    10 
       
    11 This reversal effectively disabled the scavenger on large page systems
       
    12 *except* in the rare cases where this code was originally wrong, which
       
    13 is why it didn't obviously show up in testing.
       
    14 
       
    15 Fixes #16644. Again. :(
       
    16 
       
    17 Change-Id: I27cce4aea13de217197db4b628f17860f27ce83e
       
    18 Reviewed-on: https://go-review.googlesource.com/27402
       
    19 Run-TryBot: Austin Clements <[email protected]>
       
    20 Reviewed-by: Brad Fitzpatrick <[email protected]>
       
    21 Reviewed-on: https://go-review.googlesource.com/28631
       
    22 Run-TryBot: Chris Broadfoot <[email protected]>
       
    23 ---
       
    24  src/runtime/mheap.go | 4 +++-
       
    25  1 file changed, 3 insertions(+), 1 deletion(-)
       
    26 
       
    27 diff --git a/src/runtime/mheap.go b/src/runtime/mheap.go
       
    28 index db60f7a..8db2fcc 100644
       
    29 --- a/src/runtime/mheap.go
       
    30 +++ b/src/runtime/mheap.go
       
    31 @@ -917,7 +917,9 @@ func scavengelist(list *mSpanList, now, limit uint64) uintptr {
       
    32  				// more memory than we want.)
       
    33  				start = (start + sys.PhysPageSize - 1) &^ (sys.PhysPageSize - 1)
       
    34  				end &^= sys.PhysPageSize - 1
       
    35 -				if start == end {
       
    36 +				if end <= start {
       
    37 +					// start and end don't span a
       
    38 +					// whole physical page.
       
    39  					continue
       
    40  				}
       
    41  			}
       
    42 -- 
       
    43 2.7.4
       
    44