lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20100312085438.98c5fcc4.kamezawa.hiroyu@jp.fujitsu.com>
Date:	Fri, 12 Mar 2010 08:54:38 +0900
From:	KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>
To:	"Kirill A. Shutemov" <kirill@...temov.name>
Cc:	"linux-mm@...ck.org" <linux-mm@...ck.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"nishimura@....nes.nec.co.jp" <nishimura@....nes.nec.co.jp>,
	"balbir@...ux.vnet.ibm.com" <balbir@...ux.vnet.ibm.com>
Subject: Re: [RFC][PATCH 2/3] memcg: oom notifier

Thank you.

On Thu, 11 Mar 2010 16:47:00 +0200
"Kirill A. Shutemov" <kirill@...temov.name> wrote:

> On Thu, Mar 11, 2010 at 9:57 AM, KAMEZAWA Hiroyuki
> <kamezawa.hiroyu@...fujitsu.com> wrote:
> > From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>

> >        /*
> >         * Should we move charges of a task when a task is moved into this
> >         * mem_cgroup ? And what type of charges should we move ?
> > @@ -282,9 +292,12 @@ enum charge_type {
> >  /* for encoding cft->private value on file */
> >  #define _MEM                   (0)
> >  #define _MEMSWAP               (1)
> > +#define _OOM_TYPE              (2)
> >  #define MEMFILE_PRIVATE(x, val)        (((x) << 16) | (val))
> >  #define MEMFILE_TYPE(val)      (((val) >> 16) & 0xffff)
> >  #define MEMFILE_ATTR(val)      ((val) & 0xffff)
> > +/* Used for OOM nofiier */
> > +#define OOM_CONTROL            (0)
> >
> >  /*
> >  * Reclaim flags for mem_cgroup_hierarchical_reclaim
> > @@ -1351,6 +1364,8 @@ bool mem_cgroup_handle_oom(struct mem_cg
> >         */
> >        if (!locked)
> >                prepare_to_wait(&memcg_oom_waitq, &owait.wait, TASK_KILLABLE);
> > +       else
> > +               mem_cgroup_oom_notify(mem);
> >        mutex_unlock(&memcg_oom_mutex);
> >
> >        if (locked)
> > @@ -3398,8 +3413,22 @@ static int compare_thresholds(const void
> >        return _a->threshold - _b->threshold;
> >  }
> >
> > -static int mem_cgroup_register_event(struct cgroup *cgrp, struct cftype *cft,
> > -               struct eventfd_ctx *eventfd, const char *args)
> > +static int mem_cgroup_oom_notify_cb(struct mem_cgroup *mem, void *data)
> > +{
> > +       struct mem_cgroup_eventfd_list *ev;
> > +
> > +       list_for_each_entry(ev, &mem->oom_notify, list)
> > +               eventfd_signal(ev->eventfd, 1);
> > +       return 0;
> > +}
> > +
> > +static void mem_cgroup_oom_notify(struct mem_cgroup *mem)
> > +{
> > +       mem_cgroup_walk_tree(mem, NULL, mem_cgroup_oom_notify_cb);
> > +}
> > +
> > +static int mem_cgroup_usage_register_event(struct cgroup *cgrp,
> > +       struct cftype *cft, struct eventfd_ctx *eventfd, const char *args)
> >  {
> >        struct mem_cgroup *memcg = mem_cgroup_from_cont(cgrp);
> >        struct mem_cgroup_threshold_ary *thresholds, *thresholds_new;
> > @@ -3483,8 +3512,8 @@ unlock:
> >        return ret;
> >  }
> >
> > -static int mem_cgroup_unregister_event(struct cgroup *cgrp, struct cftype *cft,
> > -               struct eventfd_ctx *eventfd)
> > +static int mem_cgroup_usage_unregister_event(struct cgroup *cgrp,
> > +       struct cftype *cft, struct eventfd_ctx *eventfd)
> >  {
> >        struct mem_cgroup *memcg = mem_cgroup_from_cont(cgrp);
> >        struct mem_cgroup_threshold_ary *thresholds, *thresholds_new;
> > @@ -3568,13 +3597,66 @@ unlock:
> >        return ret;
> >  }
> >
> > +static int mem_cgroup_oom_register_event(struct cgroup *cgrp,
> > +       struct cftype *cft, struct eventfd_ctx *eventfd, const char *args)
> > +{
> > +       struct mem_cgroup *memcg = mem_cgroup_from_cont(cgrp);
> > +       struct mem_cgroup_eventfd_list *event;
> > +       int type = MEMFILE_TYPE(cft->private);
> > +       int ret = -ENOMEM;
> > +
> > +       BUG_ON(type != _OOM_TYPE);
> > +
> > +       mutex_lock(&memcg_oom_mutex);
> > +
> > +       /* Allocate memory for new array of thresholds */
> 
> Irrelevant comment?
> 
> > +       event = kmalloc(sizeof(*event), GFP_KERNEL);
> > +       if (!event)
> > +               goto unlock;
> > +       /* Add new threshold */
> 
> Ditto.
> 
Ah...sorry for garbages..I'll clean these up.

Thanks,
-Kame

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ