[libvirt] [PATCH 4/5] qemu: Build command line for NUMA tuning

Daniel P. Berrange berrange at redhat.com
Fri May 6 09:20:39 UTC 2011


On Fri, May 06, 2011 at 10:35:48AM +0800, Osier Yang wrote:
> 于 2011年05月05日 23:21, Daniel P. Berrange 写道:
> >On Thu, May 05, 2011 at 05:38:29PM +0800, Osier Yang wrote:
> >>Just prepend numactl command line to qemu command line.
> >>---
> >>  src/qemu/qemu_command.c |   16 ++++++++++++++++
> >>  1 files changed, 16 insertions(+), 0 deletions(-)
> >>
> >>diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
> >>index 2205ed1..156fdfb 100644
> >>--- a/src/qemu/qemu_command.c
> >>+++ b/src/qemu/qemu_command.c
> >>@@ -2762,7 +2762,23 @@ qemuBuildCommandLine(virConnectPtr conn,
> >>          break;
> >>      }
> >>
> >>+#ifdef HAVE_NUMACTL
> >>+    /* XXX: Logic here to build numactl commmand line need to be changed if
> >>+     * more NUMA tuning related stuffs in future.
> >>+     */
> >>+    if (def->numatune.membind.nodeset) {
> >>+        cmd = virCommandNewArgList(NUMACTL,
> >>+                                   "-m",
> >>+                                   def->numatune.membind.nodeset,
> >>+                                   NULL);
> >>+
> >>+        virCommandAddArgList(cmd, emulator, "-S", NULL);
> >>+    } else {
> >>+        cmd = virCommandNewArgList(emulator, "-S", NULL);
> >>+    }
> >>+#else
> >>      cmd = virCommandNewArgList(emulator, "-S", NULL);
> >>+#endif
> >
> >NACK to this approach. We should be using the libnuma APIs to set the
> >memory binding for the process directly, and not running the numactl
> >command.
> 
> Hi, Dan,
> 
> I looked at libnuma API, it looks to me there is no API provided to
> change the NUMA policy for process with specified PID,
> like sched_setaffinity, think it's reasonable to not allow to set
> the policy with specified PID, otherwise if one change the NUMA
> policy for a process frequently, it will be pain for kernel.
> 
> AFAIK, If one wants to use libnuma to change a process' NUMA policy,
> one way is to use libnuma in the codes of the program for which one
> want to set the policy. The other way is to use numactl.

You don't want to set the policy for another PID. The code should
be run in the child process after fork'ing it, but before exec'ing
it.

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 :|




More information about the libvir-list mailing list