All of lore.kernel.org
 help / color / mirror / Atom feed
* A issue when migrating a process's memory using cgroup
@ 2014-04-10  7:34 xiexiangyou
       [not found] ` <53464970.8060404-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: xiexiangyou @ 2014-04-10  7:34 UTC (permalink / raw)
  To: cgroups-u79uwXL29TY76Z2rM5mHXA
  Cc: zhouxiangjiu-hv44wF8Li93QT0dZR+AlfA,
	luonengjun-hv44wF8Li93QT0dZR+AlfA

Hi all,

I met a problem when I migrate a process's memory using cgroup.
Two processes, process A and Process B. Process A has 20G memory, I migrate it from node0 to node1, by writing "1" to "cpuset.mems".
It will consume 20s time. At the time, I write process B's "cpuset.cpus" to bind the cpus. But setting "cpuset.cpus" is block untill
the first operation is finished.


So I read the cpuset code in kernel. In the function of "cpuset_write_resmask", Common handling for a write to a "cpus" or "mems" file,
It grabs the "cgroup_mutex" first, and release it until finish writing "cpus" or "mems". But if migrate large size memory
of a process using cpuset, it will consume much time. At the time, other handling for write to "cpuset.cpus" and "cpuset.mems"
will blocked because of "cgroup_mutex".

In this case, I think the "cgroup_mutex" in "cpuset_write_resmask" should be replace by littler granularity lock.


Regards,
-xie

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: A issue when migrating a process's memory using cgroup
       [not found] ` <53464970.8060404-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
@ 2014-04-10  8:04   ` Li Zefan
       [not found]     ` <534650AB.4070709-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Li Zefan @ 2014-04-10  8:04 UTC (permalink / raw)
  To: xiexiangyou
  Cc: cgroups-u79uwXL29TY76Z2rM5mHXA,
	zhouxiangjiu-hv44wF8Li93QT0dZR+AlfA,
	luonengjun-hv44wF8Li93QT0dZR+AlfA

On 2014/4/10 15:34, xiexiangyou wrote:
> Hi all,
> 
> I met a problem when I migrate a process's memory using cgroup.
> Two processes, process A and Process B. Process A has 20G memory, I migrate it from node0 to node1, by writing "1" to "cpuset.mems".
> It will consume 20s time. At the time, I write process B's "cpuset.cpus" to bind the cpus. But setting "cpuset.cpus" is block untill
> the first operation is finished.
> 
> 
> So I read the cpuset code in kernel. In the function of "cpuset_write_resmask", Common handling for a write to a "cpus" or "mems" file,
> It grabs the "cgroup_mutex" first, and release it until finish writing "cpus" or "mems". But if migrate large size memory
> of a process using cpuset, it will consume much time. At the time, other handling for write to "cpuset.cpus" and "cpuset.mems"
> will blocked because of "cgroup_mutex".
> 
> In this case, I think the "cgroup_mutex" in "cpuset_write_resmask" should be replace by littler granularity lock.
> 

Yeah, in newer kernels we no longer grab cgroup_mutex in cpuset_write_resmask().

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: A issue when migrating a process's memory using cgroup
       [not found]     ` <534650AB.4070709-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
@ 2014-04-10  8:28       ` Li Zefan
  0 siblings, 0 replies; 3+ messages in thread
From: Li Zefan @ 2014-04-10  8:28 UTC (permalink / raw)
  To: xiexiangyou
  Cc: cgroups-u79uwXL29TY76Z2rM5mHXA,
	zhouxiangjiu-hv44wF8Li93QT0dZR+AlfA,
	luonengjun-hv44wF8Li93QT0dZR+AlfA

On 2014/4/10 16:04, Li Zefan wrote:
> On 2014/4/10 15:34, xiexiangyou wrote:
>> Hi all,
>>
>> I met a problem when I migrate a process's memory using cgroup.
>> Two processes, process A and Process B. Process A has 20G memory, I migrate it from node0 to node1, by writing "1" to "cpuset.mems".
>> It will consume 20s time. At the time, I write process B's "cpuset.cpus" to bind the cpus. But setting "cpuset.cpus" is block untill
>> the first operation is finished.
>>
>>
>> So I read the cpuset code in kernel. In the function of "cpuset_write_resmask", Common handling for a write to a "cpus" or "mems" file,
>> It grabs the "cgroup_mutex" first, and release it until finish writing "cpus" or "mems". But if migrate large size memory
>> of a process using cpuset, it will consume much time. At the time, other handling for write to "cpuset.cpus" and "cpuset.mems"
>> will blocked because of "cgroup_mutex".
>>
>> In this case, I think the "cgroup_mutex" in "cpuset_write_resmask" should be replace by littler granularity lock.
>>
> 
> Yeah, in newer kernels we no longer grab cgroup_mutex in cpuset_write_resmask().
> 

But it will still block, because cpuset_mutex is still a global lock,
not a per cpuset lock.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-04-10  8:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-10  7:34 A issue when migrating a process's memory using cgroup xiexiangyou
     [not found] ` <53464970.8060404-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2014-04-10  8:04   ` Li Zefan
     [not found]     ` <534650AB.4070709-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2014-04-10  8:28       ` Li Zefan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.