OpenVZ Forum


Home » Mailing lists » Devel » kernel thread accounted to a VE
Re: kernel thread accounted to a VE [message #24925 is a reply to message #24880] Wed, 12 December 2007 08:35 Go to previous message
dev is currently offline  dev
Messages: 1693
Registered: September 2005
Location: Moscow
Senior Member

Eric Keller wrote:
> Is it possible to start a kernel thread and then move it to a particular 
> VE? 
> 
> I have the following code inside of a kernel thread:
> envid_t _veid = 200;
> // enter that VE
> unsigned flags = VE_ENTER;
> int err = real_env_create(_veid, flags, 0, 0, 0); // the last 3 
> arguments are only used if flags is VE_CREATE
> 
> I needed to modify ve_move_task() a bit.  It has the following 
> assignment:  tsk->mm->vps_dumpable = 0;    But for kernel_threads, 
> tsk->mm is NULL, so I just check if it's null and don't do the 
> assignment if it is null.  Other than that, it appears to be 
> successful.  It returns successful and in the VE I moved the task to, I 
> can see a new process running (using top).
> 
> The problem is, I set a cpu limit for that VE to 10%, yet I can see this 
> thread go well above that amount (~50%).  User processes do get limited 
> when I run them, so I know it's not a setting issue (unless there's 
> something special I need to do for kernel threads).  Note that I do not 
> want to allow the VEs to install kernel modules, so I want the host 
> system to do it on their behalf for a very specific circumstance.
> 
> Any ideas of what I'm doing wrong or what it'll take to make this work?

you can fix the place about checking for tsk->mm != NULL.
But... plz keep in mind the following:
1. having a kernel thread inside VE will break checkpointing (live migration),
   since CPT doesn't know how to restore this thread.
   (it can be fixed by you if you know how to save/restore it's state).
2. your kernel thread should handle signals or have an ability
   to detect VE shutdown, otherwise it will block VE stop.

and maybe something else...

Thanks,
Kirill
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: [PATCH 0/4] Properly handle talking to all processes in a pid namespace
Next Topic: [PATCH 2.6.25] netns: network namespace was passed into dev_getbyhwaddr but not used
Goto Forum:
  


Current Time: Tue Sep 09 14:03:43 GMT 2025

Total time taken to generate the page: 0.17522 seconds