[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20180205012754.23615-39-dbueso@wotan.suse.de>
Date: Mon, 5 Feb 2018 02:27:28 +0100
From: Davidlohr Bueso <dbueso@...e.de>
To: akpm@...ux-foundation.org, mingo@...nel.org
Cc: peterz@...radead.org, ldufour@...ux.vnet.ibm.com, jack@...e.cz,
mhocko@...nel.org, kirill.shutemov@...ux.intel.com,
mawilcox@...rosoft.com, mgorman@...hsingularity.net,
dave@...olabs.net, linux-mm@...ck.org,
linux-kernel@...r.kernel.org, Davidlohr Bueso <dbueso@...e.de>
Subject: [PATCH 38/64] arch/blackfin: use mm locking wrappers
From: Davidlohr Bueso <dave@...olabs.net>
This becomes quite straightforward with the mmrange in place.
Signed-off-by: Davidlohr Bueso <dbueso@...e.de>
---
arch/blackfin/kernel/ptrace.c | 5 +++--
arch/blackfin/kernel/trace.c | 7 ++++---
2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/arch/blackfin/kernel/ptrace.c b/arch/blackfin/kernel/ptrace.c
index a6827095b99a..e6657ab61afc 100644
--- a/arch/blackfin/kernel/ptrace.c
+++ b/arch/blackfin/kernel/ptrace.c
@@ -121,15 +121,16 @@ is_user_addr_valid(struct task_struct *child, unsigned long start, unsigned long
bool valid;
struct vm_area_struct *vma;
struct sram_list_struct *sraml;
+ DEFINE_RANGE_LOCK_FULL(mmrange);
/* overflow */
if (start + len < start)
return -EIO;
- down_read(&child->mm->mmap_sem);
+ mm_read_lock(child->mm, &mmrange);
vma = find_vma(child->mm, start);
valid = vma && start >= vma->vm_start && start + len <= vma->vm_end;
- up_read(&child->mm->mmap_sem);
+ mm_read_unlock(child->mm, &mmrange);
if (valid)
return 0;
diff --git a/arch/blackfin/kernel/trace.c b/arch/blackfin/kernel/trace.c
index 151f22196ab6..9bf938b14601 100644
--- a/arch/blackfin/kernel/trace.c
+++ b/arch/blackfin/kernel/trace.c
@@ -33,6 +33,7 @@ void decode_address(char *buf, unsigned long address)
struct mm_struct *mm;
unsigned long offset;
struct rb_node *n;
+ DEFINE_RANGE_LOCK_FULL(mmrange);
#ifdef CONFIG_KALLSYMS
unsigned long symsize;
@@ -124,7 +125,7 @@ void decode_address(char *buf, unsigned long address)
continue;
mm = t->mm;
- if (!down_read_trylock(&mm->mmap_sem))
+ if (!mm_read_trylock(mm, &mmrange))
goto __continue;
for (n = rb_first(&mm->mm_rb); n; n = rb_next(n)) {
@@ -166,7 +167,7 @@ void decode_address(char *buf, unsigned long address)
sprintf(buf, "[ %s vma:0x%lx-0x%lx]",
name, vma->vm_start, vma->vm_end);
- up_read(&mm->mmap_sem);
+ mm_read_unlock(mm, &mmrange);
task_unlock(t);
if (buf[0] == '\0')
@@ -176,7 +177,7 @@ void decode_address(char *buf, unsigned long address)
}
}
- up_read(&mm->mmap_sem);
+ mm_read_unlock(mm, &mmrange);
__continue:
task_unlock(t);
}
--
2.13.6
Powered by blists - more mailing lists