• M
    virNumaGetPageInfo: Take huge pages into account · 3499eedd
    Michal Privoznik 提交于
    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: NMichal Privoznik <mprivozn@redhat.com>
    3499eedd
nodeinfo.c 55.3 KB