public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] uprobes: use DEFINE_STATIC_PERCPU_RWSEM() to initialize dup_mmap_sem
@ 2019-04-23 15:21 Oleg Nesterov
  0 siblings, 0 replies; only message in thread
From: Oleg Nesterov @ 2019-04-23 15:21 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: Paul E. McKenney, Peter Zijlstra, linux-kernel

Use DEFINE_STATIC_PERCPU_RWSEM() to initialize dup_mmap_sem.

Signed-off-by: Oleg Nesterov <oleg@redhat.com>
---
 kernel/events/uprobes.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c
index c5cde87..76c7380 100644
--- a/kernel/events/uprobes.c
+++ b/kernel/events/uprobes.c
@@ -46,7 +46,7 @@ static DEFINE_SPINLOCK(uprobes_treelock);	/* serialize rbtree access */
 static struct mutex uprobes_mmap_mutex[UPROBES_HASH_SZ];
 #define uprobes_mmap_hash(v)	(&uprobes_mmap_mutex[((unsigned long)(v)) % UPROBES_HASH_SZ])
 
-static struct percpu_rw_semaphore dup_mmap_sem;
+DEFINE_STATIC_PERCPU_RWSEM(dup_mmap_sem);
 
 /* Have a copy of original instruction */
 #define UPROBE_COPY_INSN	0
@@ -2301,9 +2301,6 @@ static int __init init_uprobes(void)
 	for (i = 0; i < UPROBES_HASH_SZ; i++)
 		mutex_init(&uprobes_mmap_mutex[i]);
 
-	if (percpu_init_rwsem(&dup_mmap_sem))
-		return -ENOMEM;
-
 	return register_die_notifier(&uprobe_exception_nb);
 }
 __initcall(init_uprobes);
-- 
2.5.0



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2019-04-23 15:21 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-04-23 15:21 [PATCH] uprobes: use DEFINE_STATIC_PERCPU_RWSEM() to initialize dup_mmap_sem Oleg Nesterov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox