]> git.ipfire.org Git - thirdparty/libvirt.git/commit
virNumaGetPageInfo: Take huge pages into account
authorMichal Privoznik <mprivozn@redhat.com>
Mon, 23 Jun 2014 13:04:11 +0000 (15:04 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Tue, 24 Jun 2014 09:50:31 +0000 (11:50 +0200)
commit3499eedd4bb6bb48db986e2404a05e2feeb3303a
tree484d2b037635de61a1650c055e248f104869223b
parent2cff94cc85b30d3a0a33af563bb4381f988a0f3a
virNumaGetPageInfo: Take huge pages into account

On the Linux kernel, if huge pages are allocated the size they cut off
from memory is accounted under the 'MemUsed' in the meminfo file.
However, we want the sum to be subtracted from 'MemTotal'. This patch
implements this feature. After this change, we can enable reporting
of the ordinary system pages in the capability XML:

<capabilities>

  <host>
    <uuid>01281cda-f352-cb11-a9db-e905fe22010c</uuid>
    <cpu>
      <arch>x86_64</arch>
      <model>Haswell</model>
      <vendor>Intel</vendor>
      <topology sockets='1' cores='1' threads='1'/>
      <feature/>
      <pages unit='KiB' size='4'/>
      <pages unit='KiB' size='2048'/>
      <pages unit='KiB' size='1048576'/>
    </cpu>
    <power_management/>
    <migration_features/>
    <topology>
      <cells num='4'>
        <cell id='0'>
          <memory unit='KiB'>4048248</memory>
          <pages unit='KiB' size='4'>748382</pages>
          <pages unit='KiB' size='2048'>3</pages>
          <pages unit='KiB' size='1048576'>1</pages>
          <distances/>
          <cpus num='1'>
            <cpu id='0' socket_id='0' core_id='0' siblings='0'/>
          </cpus>
        </cell>
        ...
      </cells>
    </topology>
  </host>
</capabilities>

You can see the beautiful thing about this: if you sum up all the
<pages/> you'll get <memory/>.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
src/nodeinfo.c
src/util/virnuma.c
src/util/virnuma.h