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

runtime/mpallocbits.go pallocBits.summarize function problem #39990

Closed
lmtwb opened this issue Jul 2, 2020 · 6 comments
Closed

runtime/mpallocbits.go pallocBits.summarize function problem #39990

lmtwb opened this issue Jul 2, 2020 · 6 comments

Comments

@lmtwb
Copy link

@lmtwb lmtwb commented Jul 2, 2020

golang1.14.3 linux amd64

example

   var p1 pageBits
p1[0]=0b00000000_00000000_00000000_00000001_00000000_00000000_00000000_00000000
p1[1]=0b00000000_00000000_00000000_00000001_00000000_00000000_00000000_11110000
p1[2]=0b00000000_00000000_00000000_00000001_00000000_00000000_00000000_11110000
p1[3]=0b00000000_00000000_00000000_00000001_00000000_00000000_00000000_11110000
p1[4]=0b00000000_00000000_00000000_00000001_00000000_00000000_00000000_11110000
p1[5]=0b00000000_00000000_00000000_00000001_00000000_00000000_00000000_00000000
p1[6]=0b00000000_00000000_00000000_00000000_00000000_00000000_00000000_11110000
p1[7]=0b00000000_00000000_00000000_00000001_00000000_00000000_00000000_01010000
    p1summarize()
   
   // return start:32   max:63  end:31
   // I think it should return start:32 max:88 end31
  // What is the strategy of this summarizefunction when calculating max
@lmtwb lmtwb changed the title about pallocBits.summarize function problem untime/mpallocbits.go pallocBits.summarize function problem Jul 2, 2020
@lmtwb lmtwb changed the title untime/mpallocbits.go pallocBits.summarize function problem runtime/mpallocbits.go pallocBits.summarize function problem Jul 2, 2020
@ianlancetaylor
Copy link
Contributor

@ianlancetaylor ianlancetaylor commented Jul 2, 2020

@lmtwb
Copy link
Author

@lmtwb lmtwb commented Jul 3, 2020

I think the function summarize has a bug, @mknyszek think?

@randall77
Copy link
Contributor

@randall77 randall77 commented Jul 3, 2020

Why would max be 88? The max is 63. The high 31 zeroes of p1[4] and the low 32 zeroes of p1[5].

@lmtwb
Copy link
Author

@lmtwb lmtwb commented Jul 3, 2020

Why would max be 88? The max is 63. The high 31 zeroes of p1[4] and the low 32 zeroes of p1[5].

@randall77 , I think it should be The high 56 zeroes of p1[6] and the low 32 zeroes of p1[5].Where do I understand the deviation?

@randall77
Copy link
Contributor

@randall77 randall77 commented Jul 3, 2020

The bits are ordered from low to high in each word, then in increasing word index. So the high 56 zeroes of p1[6] are adjacent to the low 4 zeroes of p1[7], not the low 32 zeroes p1[5].

This doesn't look like a bug to me.

@randall77 randall77 closed this Jul 3, 2020
@lmtwb
Copy link
Author

@lmtwb lmtwb commented Jul 4, 2020

@randall77 Thank you for your answer, you're right.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.