Skip to contentSkip to conversation

cgroup notifications API and memory thresholds

RFC PATCH In review Kirill A. Shutemov 6 participants 15 messages Nov 26, 2009 6 messages not in the archive Memory management

lore
Share & tools
lore
#0 lore raw

cover cgroup notifications API and memory thresholds

It's my first attempt to implement cgroup notifications API and memory thresholds on top of it. The idea of API was proposed by Paul Menage.

It lacks some important features and need more testing, but I want publish it as soon as possible to get feedback from community.

TODO:
- memory thresholds on root cgroup;
- memsw support;
- documentation.

Kirill A. Shutemov (3):
cgroup: implement eventfd-based generic API for notifications
res_counter: implement thresholds
memcg: implement memory thresholds

 include/linux/cgroup.h      |    8 ++
 include/linux/res_counter.h |   44 +++++++++++
 kernel/cgroup.c             |  181 ++++++++++++++++++++++++++++++++++++++++++-
 kernel/res_counter.c        |    4 +
 mm/memcontrol.c             |  149 +++++++++++++++++++++++++++++++++++
 5 files changed, 385 insertions(+), 1 deletions(-)
#1 lore raw

RFC PATCH 1/3 cgroup: implement eventfd-based generic API for notifications

This patch introduces write-only file "cgroup.event_control" in every cgroup.

To register new notification handler you need:
- create an eventfd;
- open a control file to be monitored. Callbacks register_event() and unregister_event() must be defined for the control file;
- write "<event_fd> <control_fd> <args>" to cgroup.event_control. Interpretation of args is defined by control file implementation;

eventfd will be woken up by control file implementation or when the cgroup is removed.

To unregister notification handler just close eventfd.

Signature · 1 line
1.6.5.3

A message that is not in the archive (sent off-list or not yet received): cover.1259248846.git.kirill-oKw7cIdHH8eLwutG50LtGA@public.gmane.org

#3 lore raw

RFC PATCH 1/3 cgroup: implement eventfd-based generic API for notifications

This patch introduces write-only file "cgroup.event_control" in every cgroup.

To register new notification handler you need:
- create an eventfd;
- open a control file to be monitored. Callbacks register_event() and unregister_event() must be defined for the control file;
- write "<event_fd> <control_fd> <args>" to cgroup.event_control. Interpretation of args is defined by control file implementation;

eventfd will be woken up by control file implementation or when the cgroup is removed.

To unregister notification handler just close eventfd.

Signature · 1 line
1.6.5.3

A message that is not in the archive (sent off-list or not yet received): bc4dc055a7307c8667da85a4d4d9d5d189af27d5.1259248846.git.kirill-oKw7cIdHH8eLwutG50LtGA@public.gmane.org

A message that is not in the archive (sent off-list or not yet received): 8524ba285f6dd59cda939c28da523f344cdab3da.1259248846.git.kirill-oKw7cIdHH8eLwutG50LtGA@public.gmane.org

#7 lore raw

RFC PATCH 3/3 memcg: implement memory thresholds

It allows to register multiple memory thresholds and gets notifications when it crosses.

To register a threshold application need:
- create an eventfd;
- open file memory.usage_in_bytes of a cgroup
- write string "<event_fd> <memory.usage_in_bytes> <threshold>" to cgroup.event_control.

Application will be notified through eventfd when memory usage crosses threshold in any direction.

Signature · 1 line
1.6.5.3
#8 lore raw
In reply to a message not in the archive
Quoted 11 lines · Kirill A. Shutemov

It's my first attempt to implement cgroup notifications API and memory thresholds on top of it. The idea of API was proposed by Paul Menage.

It lacks some important features and need more testing, but I want publish it as soon as possible to get feedback from community.

TODO:
- memory thresholds on root cgroup;
- memsw support;
- documentation.

Maybe it would be interesting to do that for the /cgroup/<name>/tasks by sending in the event the number of tasks in the cgroup when it changes, so it more easy to detect 0 process event and then remove the cgroup directory, no ?

#10 lore raw

RFC PATCH 3/3 memcg: implement memory thresholds

It allows to register multiple memory thresholds and gets notifications when it crosses.

To register a threshold application need:
- create an eventfd;
- open file memory.usage_in_bytes of a cgroup
- write string "<event_fd> <memory.usage_in_bytes> <threshold>" to cgroup.event_control.

Application will be notified through eventfd when memory usage crosses threshold in any direction.

Signature · 7 lines
1.6.5.3

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

A message that is not in the archive (sent off-list or not yet received): d977350fcc9bc3e1fe484440c1fc3a7470a4e26b.1259248846.git.kirill-oKw7cIdHH8eLwutG50LtGA@public.gmane.org

#12 lore raw

Re: [PATCH RFC v0 3/3] memcg: implement memory thresholds

Quoted 9 lines · Kirill A. Shutemov

It allows to register multiple memory thresholds and gets notifications when it crosses.

To register a threshold application need:
- create an eventfd;
- open file memory.usage_in_bytes of a cgroup
- write string "<event_fd> <memory.usage_in_bytes> <threshold>" to cgroup.event_control.

Quoted 5 lines

Application will be notified through eventfd when memory usage crosses threshold in any direction.

I don't see the patches attached or inlined in the emails that follow

Balbir

#13 lore raw

Re: [PATCH RFC v0 3/3] memcg: implement memory thresholds

In reply to Kirill A. Shutemov
Quoted 9 lines · Kirill A. Shutemov

It allows to register multiple memory thresholds and gets notifications when it crosses.

To register a threshold application need:
- create an eventfd;
- open file memory.usage_in_bytes of a cgroup
- write string "<event_fd> <memory.usage_in_bytes> <threshold>" to cgroup.event_control.

Quoted 5 lines

Application will be notified through eventfd when memory usage crosses threshold in any direction.

I don't see the patches attached or inlined in the emails that follow

Balbir

A message that is not in the archive (sent off-list or not yet received): 661de9470911260903h4996070emec678f09a7ba2c9e-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#15 lore raw

Re: [PATCH RFC v0 3/3] memcg: implement memory thresholds

Quoted 11 lines · Balbir Singh
Quoted 9 lines · Kirill A. Shutemov

It allows to register multiple memory thresholds and gets notifications when it crosses.

To register a threshold application need:
- create an eventfd;
- open file memory.usage_in_bytes of a cgroup
- write string "<event_fd> <memory.usage_in_bytes> <threshold>" to cgroup.event_control.

Quoted 7 lines
Quoted 5 lines

Application will be notified through eventfd when memory usage crosses threshold in any direction.

I don't see the patches attached or inlined in the emails that follow

Sorry. Resent.
_______________________________________________
Containers mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/containers

#16 lore raw

Re: [PATCH RFC v0 3/3] memcg: implement memory thresholds

In reply to Balbir Singh
Quoted 11 lines · Balbir Singh
Quoted 9 lines · Kirill A. Shutemov

It allows to register multiple memory thresholds and gets notifications when it crosses.

To register a threshold application need:
- create an eventfd;
- open file memory.usage_in_bytes of a cgroup
- write string "<event_fd> <memory.usage_in_bytes> <threshold>" to cgroup.event_control.

Quoted 7 lines
Quoted 5 lines

Application will be notified through eventfd when memory usage crosses threshold in any direction.

I don't see the patches attached or inlined in the emails that follow

Sorry. Resent.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#17 lore raw
In reply to Kirill A. Shutemov
Quoted 11 lines · Kirill A. Shutemov

It's my first attempt to implement cgroup notifications API and memory thresholds on top of it. The idea of API was proposed by Paul Menage.

It lacks some important features and need more testing, but I want publish it as soon as possible to get feedback from community.

TODO:
- memory thresholds on root cgroup;
- memsw support;
- documentation.

Maybe it would be interesting to do that for the /cgroup/<name>/tasks by sending in the event the number of tasks in the cgroup when it changes, so it more easy to detect 0 process event and then remove the cgroup directory, no ?

#18 lore raw
Quoted 14 lines · Daniel Lezcano
Quoted 4 lines · Kirill A. Shutemov

It's my first attempt to implement cgroup notifications API and memory thresholds on top of it. The idea of API was proposed by Paul Menage.

Quoted 8 lines

It lacks some important features and need more testing, but I want publish it as soon as possible to get feedback from community.

TODO:
 - memory thresholds on root cgroup;
 - memsw support;
 - documentation.

Quoted 4 lines

Maybe it would be interesting to do that for the /cgroup/<name>/tasks by sending in the event the number of tasks in the cgroup when it changes, so it more easy to detect 0 process event and then remove the cgroup directory, no ?

I'll do it later.

A message that is not in the archive (sent off-list or not yet received): [email protected]

#20 lore raw
Quoted 14 lines · Daniel Lezcano
Quoted 4 lines · Kirill A. Shutemov

It's my first attempt to implement cgroup notifications API and memory thresholds on top of it. The idea of API was proposed by Paul Menage.

Quoted 8 lines

It lacks some important features and need more testing, but I want publish it as soon as possible to get feedback from community.

TODO:
 - memory thresholds on root cgroup;
 - memsw support;
 - documentation.

Quoted 4 lines

Maybe it would be interesting to do that for the /cgroup/<name>/tasks by sending in the event the number of tasks in the cgroup when it changes, so it more easy to detect 0 process event and then remove the cgroup directory, no ?

I'll do it later.
_______________________________________________
Containers mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/containers