coredump: binfmt_elf{,_fdpic}.c: don't abuse GFP_ATOMIC
Subsystems (2)
PATCH 1/1 coredump: binfmt_elf{,_fdpic}.c: don't abuse GFP_ATOMIC
kmalloc(GFP_ATOMIC) was needed because it was called under tasklist_lock. The code was changed to use rcu_read_lock(), we can use GFP_KERNEL.
binfmt_elf.c | 4 ++-- binfmt_elf_fdpic.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
fs/binfmt_elf.c renamed from fs/binfmt_elf.c~NO_ATOMIC +2 -2
@@ -1524,7 +1524,7 @@ static int fill_note_info(struct elfhdrif (p->mm == dump_task->mm) { t =kzalloc (offsetof(struct elf_thread_core_info , notes[info->thread_notes]), - GFP_ATOMIC); + GFP_KERNEL);if (unlikely (!t)) {rcu_read_unlock ();return 0 ;
@@ -1726,7 +1726,7 @@ static int fill_note_info(struct elfhdrrcu_read_lock (); do_each_thread(g, p)if (current->mm == p->mm && current != p) { - ets =kzalloc (sizeof (*ets),GFP_ATOMIC ); + ets =kzalloc (sizeof (*ets),GFP_KERNEL );if (!ets) {rcu_read_unlock ();return 0 ;
fs/binfmt_elf_fdpic.c renamed from fs/binfmt_elf_fdpic.c~NO_ATOMIC +1 -1
@@ -1626,7 +1626,7 @@ static int elf_fdpic_core_dump(long signrcu_read_lock (); do_each_thread(g,p)if (current->mm == p->mm && current != p) { - tmp =kzalloc (sizeof (*tmp),GFP_ATOMIC ); + tmp =kzalloc (sizeof (*tmp),GFP_KERNEL );if (!tmp) {rcu_read_unlock (); goto cleanup;
Quoted 2 lines · Oleg Nesterov
kmalloc(GFP_ATOMIC)was needed because it was called undertasklist_lock. The code was changed to usercu_read_lock(), we can useGFP_KERNEL.
Classic RCU - still frequently used - disables preemption and thus does not allow us to use __GFP_WAIT.
Quoted 43 lines
Signed-off-by Oleg Nesterov <[email protected]>binfmt_elf.c | 4 ++-- binfmt_elf_fdpic.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)fs/binfmt_elf.c renamed from fs/binfmt_elf.c~NO_ATOMIC +2
-2@@ -1524,7 +1524,7 @@ static int fill_note_info(struct elfhdrif (p->mm == dump_task->mm) { t =kzalloc (offsetof(struct elf_thread_core_info , notes[info->thread_notes]), - GFP_ATOMIC); + GFP_KERNEL);if (unlikely (!t)) {rcu_read_unlock ();return 0 ;@@ -1726,7 +1726,7 @@ static int fill_note_info(struct elfhdrrcu_read_lock (); do_each_thread(g, p)if (current->mm == p->mm && current != p) { - ets =kzalloc (sizeof (*ets),GFP_ATOMIC ); + ets =kzalloc (sizeof (*ets),GFP_KERNEL );if (!ets) {rcu_read_unlock ();return 0 ;fs/binfmt_elf_fdpic.c renamed from fs/binfmt_elf_fdpic.c~NO_ATOMIC +1
-2@@ -1626,7 +1626,7 @@ static int elf_fdpic_core_dump(long signrcu_read_lock (); do_each_thread(g,p)if (current->mm == p->mm && current != p) { - tmp =kzalloc (sizeof (*tmp),GFP_ATOMIC ); + tmp =kzalloc (sizeof (*tmp),GFP_KERNEL );if (!tmp) {rcu_read_unlock (); goto cleanup; --To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Quoted 7 lines · Peter Zijlstra
Quoted 2 lines · Oleg Nesterov
kmalloc(GFP_ATOMIC)was needed because it was called undertasklist_lock. The code was changed to usercu_read_lock(), we can useGFP_KERNEL.Classic RCU - still frequently used - disables preemption and thus does not allow us to use
__GFP_WAIT.
Ah, I'm stupid, thanks!
please ignore this patch.
Oleg.