Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(1)

Issue 6448132: code review 6448132: runtime: use sched_getaffinity for runtime.NumCPU() (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
12 years, 7 months ago by minux1
Modified:
12 years, 7 months ago
Reviewers:
dave
CC:
iant, golang-dev
Visibility:
Public.

Description

runtime: use sched_getaffinity for runtime.NumCPU() on Linux Fixes issue 3921.

Patch Set 1 #

Patch Set 2 : diff -r 87e3318f6a52 https://code.google.com/p/go/ #

Patch Set 3 : diff -r 87e3318f6a52 https://code.google.com/p/go/ #

Patch Set 4 : diff -r 87e3318f6a52 https://code.google.com/p/go/ #

Total comments: 4

Patch Set 5 : diff -r 9ef259879f24 https://code.google.com/p/go/ #

Patch Set 6 : diff -r 823f9cd8acba https://code.google.com/p/go/ #

Unified diffs Side-by-side diffs Delta from patch set Stats (+36 lines, -21 lines) Patch
M src/pkg/runtime/sys_linux_386.s View 1 1 chunk +8 lines, -0 lines 0 comments Download
M src/pkg/runtime/sys_linux_amd64.s View 1 2 3 4 1 chunk +8 lines, -0 lines 0 comments Download
M src/pkg/runtime/sys_linux_arm.s View 1 2 chunks +9 lines, -0 lines 0 comments Download
M src/pkg/runtime/thread_linux.c View 1 2 3 4 1 chunk +11 lines, -21 lines 0 comments Download

Messages

Total messages: 4
minux1
Hello iant@golang.org (cc: golang-dev@googlegroups.com), I'd like you to review this change to https://code.google.com/p/go/
12 years, 7 months ago (2012-08-09 15:31:31 UTC) #1
iant
LGTM Thanks! http://codereview.appspot.com/6448132/diff/6001/src/pkg/runtime/thread_linux.c File src/pkg/runtime/thread_linux.c (right): http://codereview.appspot.com/6448132/diff/6001/src/pkg/runtime/thread_linux.c#newcode83 src/pkg/runtime/thread_linux.c:83: extern runtime·sched_getaffinity(int32 pid, int32 len, uintptr *buf); ...
12 years, 7 months ago (2012-08-09 18:36:42 UTC) #2
minux1
*** Submitted as http://code.google.com/p/go/source/detail?r=3532ab6bf5be *** runtime: use sched_getaffinity for runtime.NumCPU() on Linux Fixes issue 3921. ...
12 years, 7 months ago (2012-08-10 02:05:38 UTC) #3
dave_cheney.net
12 years, 7 months ago (2012-08-10 02:11:04 UTC) #4
Very nice.

On Fri, Aug 10, 2012 at 12:05 PM,  <minux.ma@gmail.com> wrote:
> *** Submitted as
> http://code.google.com/p/go/source/detail?r=3532ab6bf5be ***
>
> runtime: use sched_getaffinity for runtime.NumCPU() on Linux
>         Fixes issue 3921.
>
> R=iant
> CC=golang-dev
> http://codereview.appspot.com/6448132
>
>
>
>
>
http://codereview.appspot.com/6448132/diff/6001/src/pkg/runtime/thread_linux.c
> File src/pkg/runtime/thread_linux.c (right):
>
>
http://codereview.appspot.com/6448132/diff/6001/src/pkg/runtime/thread_linux....
> src/pkg/runtime/thread_linux.c:83: extern
> runtime·sched_getaffinity(int32 pid, int32 len, uintptr *buf);
> On 2012/08/09 18:36:42, iant wrote:
>>
>> Seems like both pid and len should be uintptr.
>
> fixed.
>
>
>
http://codereview.appspot.com/6448132/diff/6001/src/pkg/runtime/thread_linux....
> src/pkg/runtime/thread_linux.c:95: t = t - ((t >> 1) &
> 0x5555555555555555ULL);
> On 2012/08/09 18:36:42, iant wrote:
>>
>> It's a nice algorithm but of course in SSE4.2 there is a single
>
> machine
>>
>> instruction for it.  Let's stick with this for now, though.
>
> yes, the popcnt instruction. but i think this is not that performance
> critical (besides, i will have to write 3 implementations if i want
> to take advantage of popcnt)
>
> http://codereview.appspot.com/6448132/
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b