News for hackers. Stuff that matters.
Re:Why Intel Added Cache Partitioning by nulltype on Monday October 05, 2015 @06:22PM (#10335444)
What's the accurate way?
Re:Why Intel Added Cache Partitioning by seiji on Monday October 05, 2015 @11:17PM (#10336562)
Re:Why Intel Added Cache Partitioning by dunkelheit on Monday October 05, 2015 @07:35PM (#10335753)
At the very least you should be aware that these counts usually count cores with hyperthreading twice - and hyperthreading does indeed provide opportunity for increased parallelism but it is noticeably worse than having another separate physical core.
Re:Why Intel Added Cache Partitioning by wmf on Monday October 05, 2015 @10:14PM (#10336383)
Probably something like hwloc which can be configured to show you only the cpus you're allowed to use.

BTW the same problem also happens for determining available memory in containers.

Re:Why Intel Added Cache Partitioning by uxcn on Monday October 05, 2015 @07:05PM (#10335635)
To calculate the number of processors available or the optimal number of threads/processes?
Re:Why Intel Added Cache Partitioning by nulltype on Monday October 05, 2015 @07:47PM (#10335806)
Well specifically it would be cool if it counted the optimal number to set GOMAXPROCS to, since I think that's like the main use of runtime.NumCPU().
Re:Why Intel Added Cache Partitioning by thrownaway2424 on Monday October 05, 2015 @08:15PM (#10335953)
Right. Currently runtime.NumCPU tries to be fancy by looking at the population count of the cpuset mask[1]. However in a hosted environment using containers there's no reason to believe that the cpuset will remain fixed over the life of the process. This can undercount the available CPUs, leaving you with a GOMAXPROCS that is too low.

1: https://code.google.com/p/go/source/browse/src/pkg/runtime/t...

Re:Why Intel Added Cache Partitioning by vessenes on Monday October 05, 2015 @09:07PM (#10336167)
Anecdotally, it's very often not bad, (and in fact sometimes "good") to over-provision MAXPROCS. We have used as much as 3 to 6x the number of hyperthreaded cores with good results, depending on the workload. This could insulate you against some container changes.
Re:Why Intel Added Cache Partitioning by nulltype on Monday October 05, 2015 @10:46PM (#10336468)
Seems like if they did some other metric, it could overcount the number of CPUs instead, right?

What about changing GOMAXPROCS once per minute in a goroutine that calls NumCPU()?