Skip to content

Commit

Permalink
Merge pull request grpc#13074 from grpc/revert-13021-devel-getcpu
Browse files Browse the repository at this point in the history
Revert "cpu_linux: Don't spam sched_getcpu failures on qemu"
  • Loading branch information
vjpai authored Oct 19, 2017
2 parents c7ea15e + 8514a51 commit 4b8e475
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions src/core/lib/support/cpu_linux.cc
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,8 @@ static int ncpus = 0;
static void init_num_cpus() {
/* This must be signed. sysconf returns -1 when the number cannot be
determined */
int cpu = sched_getcpu();
ncpus = (int)sysconf(_SC_NPROCESSORS_ONLN);
if (ncpus < 1 || cpu < 0) {
if (ncpus < 1) {
gpr_log(GPR_ERROR, "Cannot determine number of CPUs: assuming 1");
ncpus = 1;
}
Expand All @@ -57,9 +56,6 @@ unsigned gpr_cpu_current_cpu(void) {
// sched_getcpu() is undefined on musl
return 0;
#else
if (gpr_cpu_num_cores() == 1) {
return 0;
}
int cpu = sched_getcpu();
if (cpu < 0) {
gpr_log(GPR_ERROR, "Error determining current CPU: %s\n", strerror(errno));
Expand Down

0 comments on commit 4b8e475

Please sign in to comment.