Skip to content

Commit

Permalink
cgroup: Merge branch 'memcg_event' into for-3.14
Browse files Browse the repository at this point in the history
Merge v3.12 based patch series to move cgroup_event implementation to
memcg into for-3.14.  The following two commits cause a conflict in
kernel/cgroup.c

  2ff2a7d ("cgroup: kill css_id")
  79bd981 ("cgroup, memcg: move cgroup_event implementation to memcg")

Each patch removes a struct definition from kernel/cgroup.c.  As the
two are adjacent, they cause a context conflict.  Easily resolved by
removing both structs.

Signed-off-by: Tejun Heo <[email protected]>
  • Loading branch information
htejun committed Nov 22, 2013
2 parents e5fca24 + b36824c commit edab951
Show file tree
Hide file tree
Showing 7 changed files with 334 additions and 359 deletions.
20 changes: 0 additions & 20 deletions Documentation/cgroups/cgroups.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ CONTENTS:
2.1 Basic Usage
2.2 Attaching processes
2.3 Mounting hierarchies by name
2.4 Notification API
3. Kernel API
3.1 Overview
3.2 Synchronization
Expand Down Expand Up @@ -472,25 +471,6 @@ you give a subsystem a name.
The name of the subsystem appears as part of the hierarchy description
in /proc/mounts and /proc/<pid>/cgroups.

2.4 Notification API
--------------------

There is mechanism which allows to get notifications about changing
status of a cgroup.

To register a new notification handler you need to:
- create a file descriptor for event notification using eventfd(2);
- open a control file to be monitored (e.g. memory.usage_in_bytes);
- 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 a notification handler just close eventfd.

NOTE: Support of notifications should be implemented for the control
file. See documentation for the subsystem.

3. Kernel API
=============
Expand Down
24 changes: 0 additions & 24 deletions include/linux/cgroup.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ struct cgroup_subsys;
struct inode;
struct cgroup;
struct css_id;
struct eventfd_ctx;

extern int cgroup_init_early(void);
extern int cgroup_init(void);
Expand Down Expand Up @@ -239,10 +238,6 @@ struct cgroup {
struct rcu_head rcu_head;
struct work_struct destroy_work;

/* List of events which userspace want to receive */
struct list_head event_list;
spinlock_t event_list_lock;

/* directory xattrs */
struct simple_xattrs xattrs;
};
Expand Down Expand Up @@ -506,25 +501,6 @@ struct cftype {
int (*trigger)(struct cgroup_subsys_state *css, unsigned int event);

int (*release)(struct inode *inode, struct file *file);

/*
* register_event() callback will be used to add new userspace
* waiter for changes related to the cftype. Implement it if
* you want to provide this functionality. Use eventfd_signal()
* on eventfd to send notification to userspace.
*/
int (*register_event)(struct cgroup_subsys_state *css,
struct cftype *cft, struct eventfd_ctx *eventfd,
const char *args);
/*
* unregister_event() callback will be called when userspace
* closes the eventfd or on cgroup removing.
* This callback must be implemented, if you want provide
* notification functionality.
*/
void (*unregister_event)(struct cgroup_subsys_state *css,
struct cftype *cft,
struct eventfd_ctx *eventfd);
};

/*
Expand Down
8 changes: 3 additions & 5 deletions include/linux/vmpressure.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include <linux/gfp.h>
#include <linux/types.h>
#include <linux/cgroup.h>
#include <linux/eventfd.h>

struct vmpressure {
unsigned long scanned;
Expand All @@ -33,13 +34,10 @@ extern void vmpressure_init(struct vmpressure *vmpr);
extern void vmpressure_cleanup(struct vmpressure *vmpr);
extern struct vmpressure *memcg_to_vmpressure(struct mem_cgroup *memcg);
extern struct cgroup_subsys_state *vmpressure_to_css(struct vmpressure *vmpr);
extern struct vmpressure *css_to_vmpressure(struct cgroup_subsys_state *css);
extern int vmpressure_register_event(struct cgroup_subsys_state *css,
struct cftype *cft,
extern int vmpressure_register_event(struct mem_cgroup *memcg,
struct eventfd_ctx *eventfd,
const char *args);
extern void vmpressure_unregister_event(struct cgroup_subsys_state *css,
struct cftype *cft,
extern void vmpressure_unregister_event(struct mem_cgroup *memcg,
struct eventfd_ctx *eventfd);
#else
static inline void vmpressure(gfp_t gfp, struct mem_cgroup *memcg,
Expand Down
3 changes: 1 addition & 2 deletions init/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -848,7 +848,6 @@ config NUMA_BALANCING

menuconfig CGROUPS
boolean "Control Group support"
depends on EVENTFD
help
This option adds support for grouping sets of processes together, for
use with process control subsystems such as Cpusets, CFS, memory
Expand Down Expand Up @@ -915,6 +914,7 @@ config MEMCG
bool "Memory Resource Controller for Control Groups"
depends on RESOURCE_COUNTERS
select MM_OWNER
select EVENTFD
help
Provides a memory resource controller that manages both anonymous
memory and page cache. (See Documentation/cgroups/memory.txt)
Expand Down Expand Up @@ -1154,7 +1154,6 @@ config UIDGID_STRICT_TYPE_CHECKS

config SCHED_AUTOGROUP
bool "Automatic process group scheduling"
select EVENTFD
select CGROUPS
select CGROUP_SCHED
select FAIR_GROUP_SCHED
Expand Down
Loading

0 comments on commit edab951

Please sign in to comment.