[libvirt-users] why CPU pinning doesn't take effect when using lxc-enter-namespace to run an application

WANG Cheng D Cheng.d.Wang at alcatel-sbell.com.cn
Tue Dec 23 01:52:24 UTC 2014


Dear Martin,

Thank you for your suggestion. I have submitted a bug report on this ( libvirt version 1.2.5). For your reference, the report No. is 1176584.

Just like you said, I set the affinity of my process to temporarily solve this problem.

With my warmest regards

Cheng

-----Original Message-----
From: Martin Kletzander [mailto:mkletzan at redhat.com] 
Sent: 2014年12月22日 18:13
To: WANG Cheng D
Cc: libvirt-users at redhat.com
Subject: Re: [libvirt-users] why CPU pinning doesn't take effect when using lxc-enter-namespace to run an application

On Mon, Dec 22, 2014 at 08:40:03AM +0000, WANG Cheng D wrote:
>Dear all,
>
>I want my container to run on the third CPU core and I define this by the following xml scrpits:
><vcpu placement="static" cpuset="3">1</vcpu>
>
>When I run my application in a container terminal, I can see the application runs on the third core as expected.
>When I run my application using lxc-enter-namespace, the CPU pinning doesn't take effect, i.e., the application runs on a core which isn't the third one.
>

I'm not expert on lxc namespaces, but looking at the code I think that
virDomainLxcEnterNamespace() just doesn't care about such settings.
It does not put the PID created into the cgroup of that container nor does it put anywhere else.

>How can I solve this problem?
>

I'm thinking of patching this part, but unsure what the right approach should be it feels like guessing.  Could you create a bug for this issue, so we can track, please?

In the meantime, I think it would work if you set the affinity of your process which is calling virDomainLxcEnterNamespace() before and restore it afterwards.

Martin

>Any replies are highly appreciated.
>
>Cheng

>_______________________________________________
>libvirt-users mailing list
>libvirt-users at redhat.com
>https://www.redhat.com/mailman/listinfo/libvirt-users




More information about the libvirt-users mailing list