Re: [PATCH 2/5] virCaps: expose huge page info

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Jun 12, 2014 at 02:30:50PM +0100, Daniel P. Berrange wrote:
On Tue, Jun 10, 2014 at 07:21:12PM +0200, Michal Privoznik wrote:
There are two places where you'll find info on huge pages. The first
one is under <cpu/> element, where all supported huge page sizes are
listed. Then the second one is under each <cell/> element which refers
to concrete NUMA node. At this place, the size of huge page's pool is
reported. So the capabilities XML looks something like this:

<capabilities>

  <host>
    <uuid>01281cda-f352-cb11-a9db-e905fe22010c</uuid>
    <cpu>
      <arch>x86_64</arch>
      <model>Westmere</model>
      <vendor>Intel</vendor>
      <topology sockets='1' cores='1' threads='1'/>
      ...
      <pages unit='KiB' size='1048576'/>
      <pages unit='KiB' size='2048'/>

Should have normal sized pages (ie 4k on x86) too, to avoid
apps having to special case small pages.


Since we have to special-case small pages and kernel (at least to my
knowledge) doesn't expose that information by classic means, I think
reporting only hugepages is actually what we want here.  For normal
memory there are existing APIs already.

Hugepages are different mainly because of one thing.  The fact that
there are some hugepages allocated is known by the user of the machine
(be it mgmt app or an admin) and these hugepages were allocated for
some purpose.  It is fairly OK to presume that the number of hugepages
(free or total) will change only when and if the user wants to
(e.g. running a machine with specified size and hugepages).  That
cannot be said about small pages, though, and I think it is fair
reason to special-case normal pages like this.

Martin

    </cpu>
    ...
    <topology>
      <cells num='4'>
        <cell id='0'>
          <memory unit='KiB'>4054408</memory>
          <pages unit='KiB' size='1048576'>1</pages>
          <pages unit='KiB' size='2048'>3</pages>

Should have normal sized pages here too.

We should also declare whether '<memory>' refers to total memory
across all page sizes, or just total memory of smallest page
sizes. I'd say it should refer to all memory, since conceptually
this is really about telling you how much RAM DIMMS are in each
node.

          <distances/>
          <cpus num='1'>
            <cpu id='0' socket_id='0' core_id='0' siblings='0'/>
          </cpus>
        </cell>
        <cell id='1'>
          <memory unit='KiB'>4071072</memory>
          <pages unit='KiB' size='1048576'>2</pages>
          <pages unit='KiB' size='2048'>1024</pages>
          <distances/>
          <cpus num='1'>
            <cpu id='1' socket_id='0' core_id='0' siblings='1'/>
          </cpus>
        </cell>
        ...
      </cells>
    </topology>
    ...
  </host>

  <guest/>

</capabilities>

Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
---
 docs/schemas/capability.rng  | 21 +++++++++++++++++++++
 src/conf/capabilities.c      | 25 ++++++++++++++++++++++---
 src/conf/capabilities.h      | 15 ++++++++++++++-
 src/libxl/libxl_conf.c       |  1 +
 src/nodeinfo.c               | 41 ++++++++++++++++++++++++++++++++++++++++-
 src/qemu/qemu_capabilities.c | 29 ++++++++++++++++++++++++++++-
 src/test/test_driver.c       |  2 +-
 src/xen/xend_internal.c      |  1 +
 tests/vircaps2xmltest.c      |  3 ++-
 tests/vircapstest.c          |  1 +
 10 files changed, 131 insertions(+), 8 deletions(-)

diff --git a/src/conf/capabilities.h b/src/conf/capabilities.h
index 53a83c9..384e256 100644
--- a/src/conf/capabilities.h
+++ b/src/conf/capabilities.h
@@ -102,6 +102,13 @@ struct _virCapsHostNUMACellSiblingInfo {
     unsigned int distance;  /* distance to the node */
 };

+typedef struct _virCapsHostNUMACellHugePageInfo virCapsHostNUMACellHugePageInfo;
+typedef virCapsHostNUMACellHugePageInfo *virCapsHostNUMACellHugePageInfoPtr;
+struct _virCapsHostNUMACellHugePageInfo {
+    unsigned int size;      /* huge page size in kibibytes */
+    size_t avail;           /* the size of pool */
+};

s/Huge//. since this should be used to report on all page sizes

+
 typedef struct _virCapsHostNUMACell virCapsHostNUMACell;
 typedef virCapsHostNUMACell *virCapsHostNUMACellPtr;
 struct _virCapsHostNUMACell {
@@ -111,6 +118,8 @@ struct _virCapsHostNUMACell {
     virCapsHostNUMACellCPUPtr cpus;
     int nsiblings;
     virCapsHostNUMACellSiblingInfoPtr siblings;
+    int nhugepages;
+    virCapsHostNUMACellHugePageInfoPtr hugepages;

Better named as 'pageinfo' rather than 'hugepages'


Regards,
Daniel
--
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

Attachment: signature.asc
Description: Digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]