OpenVZ Forum


Home » Mailing lists » Devel » [RFC][ only for review ] memory controller bacground reclaim [0/5]
Re: [RFC][ only for review ] memory controller bacground reclaim [5/5] [message #23927 is a reply to message #23888] Thu, 29 November 2007 01:26 Go to previous messageGo to previous message
KAMEZAWA Hiroyuki is currently offline  KAMEZAWA Hiroyuki
Messages: 463
Registered: September 2006
Senior Member
On Wed, 28 Nov 2007 14:06:22 +0300
Pavel Emelyanov <xemul@openvz.org> wrote:
> > +	struct {
> > +		wait_queue_head_t waitq;
> > +		struct task_struct *thread;
> > +	} daemon;
> 
> Does this HAS to be a struct?
> 
No, but for shorter name of member.
(I'd like to add another waitq for avoiding contention in reclaiming,
 If I can.)


> > + * Background page reclaim daeom for memory controller.
> > + */
> > +
> > +static int mem_cgroup_reclaim_daemon(void *data)
> > +{
> > +	DEFINE_WAIT(wait);
> > +	struct mem_cgroup *mem = data;
> > +
> > +	css_get(&mem->css);
> 
> Won't this prevent the css from being removed?
> 
This refcnt is dropped when this thread dies.
pre_destroy handler handles this at rmdir().


> >  	struct mem_cgroup *mem = mem_cgroup_from_cont(cont);
> >  	int ret;
> > +
> 
> This hunk is not needed :)
> 
yes :)

> >  	ret = mem_cgroup_force_empty(mem);
> >  	if (!ret)
> >  		ret = nbytes;
> > @@ -1188,6 +1244,16 @@
> >  
> >  static struct mem_cgroup init_mem_cgroup;
> >  
> > +static int __init mem_cgroup_reclaim_init(void)
> > +{
> > +	init_mem_cgroup.daemon.thread = kthread_run(mem_cgroup_reclaim_daemon,
> > +					&init_mem_cgroup, "memcontd");
> > +	if (IS_ERR(init_mem_cgroup.daemon.thread))
> > +		BUG();
> > +	return 0;
> > +}
> > +late_initcall(mem_cgroup_reclaim_init);
> > +
> >  static struct cgroup_subsys_state *
> >  mem_cgroup_create(struct cgroup_subsys *ss, struct cgroup *cont)
> >  {
> > @@ -1212,6 +1278,17 @@
> >  		if (alloc_mem_cgroup_per_zone_info(mem, node))
> >  			goto free_out;
> >  
> > +	/* Memory Reclaim Daemon per cgroup */
> > +	init_waitqueue_head(&mem->daemon.waitq);
> > +	if (mem != &init_mem_cgroup) {
> > +		/* Complicated...but we cannot call kthread create here..*/
> > +		/* init call will later assign kthread */
> > +		mem->daemon.thread = kthread_run(mem_cgroup_reclaim_daemon,
> > +					mem, "memcontd");
> > +		if (IS_ERR(mem->daemon.thread))
> > +			goto free_out;
> 
> goto free_mem_cgroup_per_zone_info()?
> 
Ah.. there may be some bugs. will fix soon.

Thank you for all your comments.

Regards,
-Kame

_______________________________________________
Containers mailing list
Containers@lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/containers
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: [PATCH net-2.6.25 2/3][IPV6] Unify and cleanup calls to addrconf_sysctl_register
Next Topic: [PATCH 0/4 net-2.6.15][UNIX] Make unix sysctls per-namespace
Goto Forum:
  


Current Time: Thu Oct 09 19:53:02 GMT 2025

Total time taken to generate the page: 0.09237 seconds