OpenVZ Forum


Home » Mailing lists » Devel » [PATCH 0/3] Implement triggers for control groups.
Re: [PATCH 1/3] Add the trigger callback to struct cftype [message #28300 is a reply to message #28298] Thu, 13 March 2008 12:19 Go to previous messageGo to previous message
Paul Menage is currently offline  Paul Menage
Messages: 642
Registered: September 2006
Senior Member
On Thu, Mar 13, 2008 at 4:36 AM, Pavel Emelyanov <xemul@openvz.org> wrote:
> Trigger callback can be used to receive a kick-up from the
>  user space. The string written is ignored.
>
>  The cftype->private is used for multiplexing events.
>
>  Signed-off-by: Pavel Emelyanov <xemul@openvz.org>

Acked-by: Paul Menage <menage@google.com>

I'm not sure about the behaviour of passing cft->private rather than
just cft, but we can always change that later if it turns that some
user needs the cft pointer for some other reason.

Paul

>
>  ---
>   include/linux/cgroup.h |    8 ++++++++
>   kernel/cgroup.c        |    4 ++++
>   2 files changed, 12 insertions(+), 0 deletions(-)
>
>  diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
>  index 785a01c..2d1d151 100644
>  --- a/include/linux/cgroup.h
>  +++ b/include/linux/cgroup.h
>  @@ -243,6 +243,14 @@ struct cftype {
>          */
>         int (*write_s64) (struct cgroup *cgrp, struct cftype *cft, s64 val);
>
>  +       /*
>  +        * trigger() callback can be used to get some kick from the
>  +        * userspace, when the actual string written is not important
>  +        * at all. The private field can be used to determine the
>  +        * kick type for multiplexing.
>  +        */
>  +       int (*trigger)(struct cgroup *cgrp, unsigned int event);
>  +
>         int (*release) (struct inode *inode, struct file *file);
>   };
>
>  diff --git a/kernel/cgroup.c b/kernel/cgroup.c
>  index e8e8ec4..f2d8f25 100644
>  --- a/kernel/cgroup.c
>  +++ b/kernel/cgroup.c
>  @@ -1410,6 +1410,10 @@ static ssize_t cgroup_file_write(struct file *file, const char __user *buf,
>                 return cft->write(cgrp, cft, file, buf, nbytes, ppos);
>         if (cft->write_u64 || cft->write_s64)
>                 return cgroup_write_X64(cgrp, cft, file, buf, nbytes, ppos);
>  +       if (cft->trigger) {
>  +               int ret = cft->trigger(cgrp, (unsigned int)cft->private);
>  +               return ret ? ret : nbytes;
>  +       }
>         return -EINVAL;
>   }
>
>  --
>  1.5.3.4
>
>
_______________________________________________
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
Previous Topic: Re: [PATCH 3/3] memcgoup: allow memory.failcnt to be reset
Next Topic: Containers don't handle keys, but should they?
Goto Forum:
  


Current Time: Wed Sep 10 21:39:28 GMT 2025

Total time taken to generate the page: 0.10943 seconds