Uploaded image for project: 'Funtoo Linux'
  1. Funtoo Linux
  2. FL-6227

portage calculates incorrect # of CPUS inside LXD Container

Details

    • Bug
    • Status: Closed
    • Normal
    • Resolution: Fixed
    • None
    • None

    Description

      The current version of portage, 2.3.47, relies on multiprocessing.cpu_count() to determine the number of cores, which under LXD can give the number of cores on the host regardless of the actual # of CPUs allocated to the container. Portage should use a method that involves looking at /proc/cpuinfo instead.

      The problem code is in lib/portage/util/cpuinfo.py.

      Example difference:

      # python3
      Python 3.6.6 (default, Dec  1 2018, 08:39:55) 
      [GCC 7.3.1 20181104] on linux
      Type "help", "copyright", "credits" or "license" for more information.
      >>> import multiprocessing
      >>> multiprocessing.cpu_count()
      80
      

       

       # cat /proc/cpuinfo | grep "^processor" | wc -l
      8
      

      Attachments

        Activity

          People

            drobbins drobbins
            drobbins drobbins
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: