aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/events/uprobes.c
diff options
context:
space:
mode:
authorOleg Nesterov <oleg@redhat.com>2012-06-15 11:43:36 -0400
committerIngo Molnar <mingo@kernel.org>2012-06-16 03:10:44 -0400
commit7a5bfb66b07f22d2429db776da7bb8b57bfb5cff (patch)
treeaa6a419726f99052171f05b004db45692fef3315 /kernel/events/uprobes.c
parent268720903f87e0b84b161626c4447b81671b5d18 (diff)
uprobes: Change build_map_info() to try kmalloc(GFP_NOWAIT) first
build_map_info() doesn't allocate the memory under i_mmap_mutex to avoid the deadlock with page reclaim. But it can try GFP_NOWAIT first, it should work in the likely case and thus we almost never need the pre-alloc-and-retry path. Signed-off-by: Oleg Nesterov <oleg@redhat.com> Acked-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com> Acked-by: Peter Zijlstra <peterz@infradead.org> Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com> Cc: Anton Arapov <anton@redhat.com> Link: http://lkml.kernel.org/r/20120615154336.GA9588@redhat.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'kernel/events/uprobes.c')
-rw-r--r--kernel/events/uprobes.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c
index 4e0db3496d70..897417dbca8e 100644
--- a/kernel/events/uprobes.c
+++ b/kernel/events/uprobes.c
@@ -761,6 +761,16 @@ build_map_info(struct address_space *mapping, loff_t offset, bool is_register)
761 if (!valid_vma(vma, is_register)) 761 if (!valid_vma(vma, is_register))
762 continue; 762 continue;
763 763
764 if (!prev && !more) {
765 /*
766 * Needs GFP_NOWAIT to avoid i_mmap_mutex recursion through
767 * reclaim. This is optimistic, no harm done if it fails.
768 */
769 prev = kmalloc(sizeof(struct map_info),
770 GFP_NOWAIT | __GFP_NOMEMALLOC | __GFP_NOWARN);
771 if (prev)
772 prev->next = NULL;
773 }
764 if (!prev) { 774 if (!prev) {
765 more++; 775 more++;
766 continue; 776 continue;