diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2019-07-17 11:58:04 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2019-07-17 11:58:04 -0400 |
commit | 57a8ec387e1441ea5e1232bc0749fb99a8cba7e7 (patch) | |
tree | b5fb03fc6bc5754de8b5b1f8b0e4f36d67c8315c /kernel/pid.c | |
parent | 0a8ad0ffa4d80a544f6cbff703bf6394339afcdf (diff) | |
parent | 43e11fa2d1d3b6e35629fa556eb7d571edba2010 (diff) |
Merge branch 'akpm' (patches from Andrew)
Merge more updates from Andrew Morton:
"VM:
- z3fold fixes and enhancements by Henry Burns and Vitaly Wool
- more accurate reclaimed slab caches calculations by Yafang Shao
- fix MAP_UNINITIALIZED UAPI symbol to not depend on config, by
Christoph Hellwig
- !CONFIG_MMU fixes by Christoph Hellwig
- new novmcoredd parameter to omit device dumps from vmcore, by
Kairui Song
- new test_meminit module for testing heap and pagealloc
initialization, by Alexander Potapenko
- ioremap improvements for huge mappings, by Anshuman Khandual
- generalize kprobe page fault handling, by Anshuman Khandual
- device-dax hotplug fixes and improvements, by Pavel Tatashin
- enable synchronous DAX fault on powerpc, by Aneesh Kumar K.V
- add pte_devmap() support for arm64, by Robin Murphy
- unify locked_vm accounting with a helper, by Daniel Jordan
- several misc fixes
core/lib:
- new typeof_member() macro including some users, by Alexey Dobriyan
- make BIT() and GENMASK() available in asm, by Masahiro Yamada
- changed LIST_POISON2 on x86_64 to 0xdead000000000122 for better
code generation, by Alexey Dobriyan
- rbtree code size optimizations, by Michel Lespinasse
- convert struct pid count to refcount_t, by Joel Fernandes
get_maintainer.pl:
- add --no-moderated switch to skip moderated ML's, by Joe Perches
misc:
- ptrace PTRACE_GET_SYSCALL_INFO interface
- coda updates
- gdb scripts, various"
[ Using merge message suggestion from Vlastimil Babka, with some editing - Linus ]
* emailed patches from Andrew Morton <akpm@linux-foundation.org>: (100 commits)
fs/select.c: use struct_size() in kmalloc()
mm: add account_locked_vm utility function
arm64: mm: implement pte_devmap support
mm: introduce ARCH_HAS_PTE_DEVMAP
mm: clean up is_device_*_page() definitions
mm/mmap: move common defines to mman-common.h
mm: move MAP_SYNC to asm-generic/mman-common.h
device-dax: "Hotremove" persistent memory that is used like normal RAM
mm/hotplug: make remove_memory() interface usable
device-dax: fix memory and resource leak if hotplug fails
include/linux/lz4.h: fix spelling and copy-paste errors in documentation
ipc/mqueue.c: only perform resource calculation if user valid
include/asm-generic/bug.h: fix "cut here" for WARN_ON for __WARN_TAINT architectures
scripts/gdb: add helpers to find and list devices
scripts/gdb: add lx-genpd-summary command
drivers/pps/pps.c: clear offset flags in PPS_SETPARAMS ioctl
kernel/pid.c: convert struct pid count to refcount_t
drivers/rapidio/devices/rio_mport_cdev.c: NUL terminate some strings
select: shift restore_saved_sigmask_unless() into poll_select_copy_remaining()
select: change do_poll() to return -ERESTARTNOHAND rather than -EINTR
...
Diffstat (limited to 'kernel/pid.c')
-rw-r--r-- | kernel/pid.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/kernel/pid.c b/kernel/pid.c index 16263b526560..0a9f2e437217 100644 --- a/kernel/pid.c +++ b/kernel/pid.c | |||
@@ -37,14 +37,14 @@ | |||
37 | #include <linux/init_task.h> | 37 | #include <linux/init_task.h> |
38 | #include <linux/syscalls.h> | 38 | #include <linux/syscalls.h> |
39 | #include <linux/proc_ns.h> | 39 | #include <linux/proc_ns.h> |
40 | #include <linux/proc_fs.h> | 40 | #include <linux/refcount.h> |
41 | #include <linux/anon_inodes.h> | 41 | #include <linux/anon_inodes.h> |
42 | #include <linux/sched/signal.h> | 42 | #include <linux/sched/signal.h> |
43 | #include <linux/sched/task.h> | 43 | #include <linux/sched/task.h> |
44 | #include <linux/idr.h> | 44 | #include <linux/idr.h> |
45 | 45 | ||
46 | struct pid init_struct_pid = { | 46 | struct pid init_struct_pid = { |
47 | .count = ATOMIC_INIT(1), | 47 | .count = REFCOUNT_INIT(1), |
48 | .tasks = { | 48 | .tasks = { |
49 | { .first = NULL }, | 49 | { .first = NULL }, |
50 | { .first = NULL }, | 50 | { .first = NULL }, |
@@ -108,8 +108,7 @@ void put_pid(struct pid *pid) | |||
108 | return; | 108 | return; |
109 | 109 | ||
110 | ns = pid->numbers[pid->level].ns; | 110 | ns = pid->numbers[pid->level].ns; |
111 | if ((atomic_read(&pid->count) == 1) || | 111 | if (refcount_dec_and_test(&pid->count)) { |
112 | atomic_dec_and_test(&pid->count)) { | ||
113 | kmem_cache_free(ns->pid_cachep, pid); | 112 | kmem_cache_free(ns->pid_cachep, pid); |
114 | put_pid_ns(ns); | 113 | put_pid_ns(ns); |
115 | } | 114 | } |
@@ -212,7 +211,7 @@ struct pid *alloc_pid(struct pid_namespace *ns) | |||
212 | } | 211 | } |
213 | 212 | ||
214 | get_pid_ns(ns); | 213 | get_pid_ns(ns); |
215 | atomic_set(&pid->count, 1); | 214 | refcount_set(&pid->count, 1); |
216 | for (type = 0; type < PIDTYPE_MAX; ++type) | 215 | for (type = 0; type < PIDTYPE_MAX; ++type) |
217 | INIT_HLIST_HEAD(&pid->tasks[type]); | 216 | INIT_HLIST_HEAD(&pid->tasks[type]); |
218 | 217 | ||