Skip to content

Commit edab951

Browse files
committed
cgroup: Merge branch 'memcg_event' into for-3.14
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 <tj@kernel.org>
2 parents e5fca24 + b36824c commit edab951

7 files changed

Lines changed: 334 additions & 359 deletions

File tree

‎Documentation/cgroups/cgroups.txt‎

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ CONTENTS:
2424
2.1 Basic Usage
2525
2.2 Attaching processes
2626
2.3 Mounting hierarchies by name
27-
2.4 Notification API
2827
3. Kernel API
2928
3.1 Overview
3029
3.2 Synchronization
@@ -472,25 +471,6 @@ you give a subsystem a name.
472471
The name of the subsystem appears as part of the hierarchy description
473472
in /proc/mounts and /proc/<pid>/cgroups.
474473

475-
2.4 Notification API
476-
--------------------
477-
478-
There is mechanism which allows to get notifications about changing
479-
status of a cgroup.
480-
481-
To register a new notification handler you need to:
482-
- create a file descriptor for event notification using eventfd(2);
483-
- open a control file to be monitored (e.g. memory.usage_in_bytes);
484-
- write "<event_fd> <control_fd> <args>" to cgroup.event_control.
485-
Interpretation of args is defined by control file implementation;
486-
487-
eventfd will be woken up by control file implementation or when the
488-
cgroup is removed.
489-
490-
To unregister a notification handler just close eventfd.
491-
492-
NOTE: Support of notifications should be implemented for the control
493-
file. See documentation for the subsystem.
494474

495475
3. Kernel API
496476
=============

‎include/linux/cgroup.h‎

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ struct cgroup_subsys;
2929
struct inode;
3030
struct cgroup;
3131
struct css_id;
32-
struct eventfd_ctx;
3332

3433
extern int cgroup_init_early(void);
3534
extern int cgroup_init(void);
@@ -239,10 +238,6 @@ struct cgroup {
239238
struct rcu_head rcu_head;
240239
struct work_struct destroy_work;
241240

242-
/* List of events which userspace want to receive */
243-
struct list_head event_list;
244-
spinlock_t event_list_lock;
245-
246241
/* directory xattrs */
247242
struct simple_xattrs xattrs;
248243
};
@@ -506,25 +501,6 @@ struct cftype {
506501
int (*trigger)(struct cgroup_subsys_state *css, unsigned int event);
507502

508503
int (*release)(struct inode *inode, struct file *file);
509-
510-
/*
511-
* register_event() callback will be used to add new userspace
512-
* waiter for changes related to the cftype. Implement it if
513-
* you want to provide this functionality. Use eventfd_signal()
514-
* on eventfd to send notification to userspace.
515-
*/
516-
int (*register_event)(struct cgroup_subsys_state *css,
517-
struct cftype *cft, struct eventfd_ctx *eventfd,
518-
const char *args);
519-
/*
520-
* unregister_event() callback will be called when userspace
521-
* closes the eventfd or on cgroup removing.
522-
* This callback must be implemented, if you want provide
523-
* notification functionality.
524-
*/
525-
void (*unregister_event)(struct cgroup_subsys_state *css,
526-
struct cftype *cft,
527-
struct eventfd_ctx *eventfd);
528504
};
529505

530506
/*

‎include/linux/vmpressure.h‎

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include <linux/gfp.h>
88
#include <linux/types.h>
99
#include <linux/cgroup.h>
10+
#include <linux/eventfd.h>
1011

1112
struct vmpressure {
1213
unsigned long scanned;
@@ -33,13 +34,10 @@ extern void vmpressure_init(struct vmpressure *vmpr);
3334
extern void vmpressure_cleanup(struct vmpressure *vmpr);
3435
extern struct vmpressure *memcg_to_vmpressure(struct mem_cgroup *memcg);
3536
extern struct cgroup_subsys_state *vmpressure_to_css(struct vmpressure *vmpr);
36-
extern struct vmpressure *css_to_vmpressure(struct cgroup_subsys_state *css);
37-
extern int vmpressure_register_event(struct cgroup_subsys_state *css,
38-
struct cftype *cft,
37+
extern int vmpressure_register_event(struct mem_cgroup *memcg,
3938
struct eventfd_ctx *eventfd,
4039
const char *args);
41-
extern void vmpressure_unregister_event(struct cgroup_subsys_state *css,
42-
struct cftype *cft,
40+
extern void vmpressure_unregister_event(struct mem_cgroup *memcg,
4341
struct eventfd_ctx *eventfd);
4442
#else
4543
static inline void vmpressure(gfp_t gfp, struct mem_cgroup *memcg,

‎init/Kconfig‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -848,7 +848,6 @@ config NUMA_BALANCING
848848

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

11551155
config SCHED_AUTOGROUP
11561156
bool "Automatic process group scheduling"
1157-
select EVENTFD
11581157
select CGROUPS
11591158
select CGROUP_SCHED
11601159
select FAIR_GROUP_SCHED

0 commit comments

Comments
 (0)