diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2015-09-02 11:04:23 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-09-02 11:04:23 -0400 |
| commit | 8bdc69b764013a9b5ebeef7df8f314f1066c5d79 (patch) | |
| tree | 335dcb29c9ba06142917121d551575d360eca63e /kernel/fork.c | |
| parent | 76ec51ef5edfe540bbc3c61b860f88deb8e6a37b (diff) | |
| parent | 20f1f4b5ffb870631bf4a4e7c7ba10e3528ae6a6 (diff) | |
Merge branch 'for-4.3' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup
Pull cgroup updates from Tejun Heo:
- a new PIDs controller is added. It turns out that PIDs are actually
an independent resource from kmem due to the limited PID space.
- more core preparations for the v2 interface. Once cpu side interface
is settled, it should be ready for lifting the devel mask.
for-4.3-unified-base was temporarily branched so that other trees
(block) can pull cgroup core changes that blkcg changes depend on.
- a non-critical idr_preload usage bug fix.
* 'for-4.3' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup:
cgroup: pids: fix invalid get/put usage
cgroup: introduce cgroup_subsys->legacy_name
cgroup: don't print subsystems for the default hierarchy
cgroup: make cftype->private a unsigned long
cgroup: export cgrp_dfl_root
cgroup: define controller file conventions
cgroup: fix idr_preload usage
cgroup: add documentation for the PIDs controller
cgroup: implement the PIDs subsystem
cgroup: allow a cgroup subsystem to reject a fork
Diffstat (limited to 'kernel/fork.c')
| -rw-r--r-- | kernel/fork.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/kernel/fork.c b/kernel/fork.c index 2b1a61cddc19..03aa2e6de7a4 100644 --- a/kernel/fork.c +++ b/kernel/fork.c | |||
| @@ -1246,6 +1246,7 @@ static struct task_struct *copy_process(unsigned long clone_flags, | |||
| 1246 | { | 1246 | { |
| 1247 | int retval; | 1247 | int retval; |
| 1248 | struct task_struct *p; | 1248 | struct task_struct *p; |
| 1249 | void *cgrp_ss_priv[CGROUP_CANFORK_COUNT] = {}; | ||
| 1249 | 1250 | ||
| 1250 | if ((clone_flags & (CLONE_NEWNS|CLONE_FS)) == (CLONE_NEWNS|CLONE_FS)) | 1251 | if ((clone_flags & (CLONE_NEWNS|CLONE_FS)) == (CLONE_NEWNS|CLONE_FS)) |
| 1251 | return ERR_PTR(-EINVAL); | 1252 | return ERR_PTR(-EINVAL); |
| @@ -1518,6 +1519,16 @@ static struct task_struct *copy_process(unsigned long clone_flags, | |||
| 1518 | p->task_works = NULL; | 1519 | p->task_works = NULL; |
| 1519 | 1520 | ||
| 1520 | /* | 1521 | /* |
| 1522 | * Ensure that the cgroup subsystem policies allow the new process to be | ||
| 1523 | * forked. It should be noted the the new process's css_set can be changed | ||
| 1524 | * between here and cgroup_post_fork() if an organisation operation is in | ||
| 1525 | * progress. | ||
| 1526 | */ | ||
| 1527 | retval = cgroup_can_fork(p, cgrp_ss_priv); | ||
| 1528 | if (retval) | ||
| 1529 | goto bad_fork_free_pid; | ||
| 1530 | |||
| 1531 | /* | ||
| 1521 | * Make it visible to the rest of the system, but dont wake it up yet. | 1532 | * Make it visible to the rest of the system, but dont wake it up yet. |
| 1522 | * Need tasklist lock for parent etc handling! | 1533 | * Need tasklist lock for parent etc handling! |
| 1523 | */ | 1534 | */ |
| @@ -1553,7 +1564,7 @@ static struct task_struct *copy_process(unsigned long clone_flags, | |||
| 1553 | spin_unlock(¤t->sighand->siglock); | 1564 | spin_unlock(¤t->sighand->siglock); |
| 1554 | write_unlock_irq(&tasklist_lock); | 1565 | write_unlock_irq(&tasklist_lock); |
| 1555 | retval = -ERESTARTNOINTR; | 1566 | retval = -ERESTARTNOINTR; |
| 1556 | goto bad_fork_free_pid; | 1567 | goto bad_fork_cancel_cgroup; |
| 1557 | } | 1568 | } |
| 1558 | 1569 | ||
| 1559 | if (likely(p->pid)) { | 1570 | if (likely(p->pid)) { |
| @@ -1595,7 +1606,7 @@ static struct task_struct *copy_process(unsigned long clone_flags, | |||
| 1595 | write_unlock_irq(&tasklist_lock); | 1606 | write_unlock_irq(&tasklist_lock); |
| 1596 | 1607 | ||
| 1597 | proc_fork_connector(p); | 1608 | proc_fork_connector(p); |
| 1598 | cgroup_post_fork(p); | 1609 | cgroup_post_fork(p, cgrp_ss_priv); |
| 1599 | if (clone_flags & CLONE_THREAD) | 1610 | if (clone_flags & CLONE_THREAD) |
| 1600 | threadgroup_change_end(current); | 1611 | threadgroup_change_end(current); |
| 1601 | perf_event_fork(p); | 1612 | perf_event_fork(p); |
| @@ -1605,6 +1616,8 @@ static struct task_struct *copy_process(unsigned long clone_flags, | |||
| 1605 | 1616 | ||
| 1606 | return p; | 1617 | return p; |
| 1607 | 1618 | ||
| 1619 | bad_fork_cancel_cgroup: | ||
| 1620 | cgroup_cancel_fork(p, cgrp_ss_priv); | ||
| 1608 | bad_fork_free_pid: | 1621 | bad_fork_free_pid: |
| 1609 | if (pid != &init_struct_pid) | 1622 | if (pid != &init_struct_pid) |
| 1610 | free_pid(pid); | 1623 | free_pid(pid); |
