From: Davidlohr Bueso <dave@stgolabs.net>
To: akpm@linux-foundation.org
Cc: linux-mm@kvack.org, dave@stgolabs.net,
linux-kernel@vger.kernel.org, Ralf Baechle <ralf@linux-mips.org>,
Paul Burton <paul.burton@mips.com>,
James Hogan <jhogan@kernel.org>,
linux-mips@vger.kernel.org, Davidlohr Bueso <dbueso@suse.de>
Subject: [PATCH 2/2] MIPS/c-r4k: do no use mmap_sem for gup_fast()
Date: Wed, 6 Feb 2019 21:37:40 -0800 [thread overview]
Message-ID: <20190207053740.26915-3-dave@stgolabs.net> (raw)
In-Reply-To: <20190207053740.26915-1-dave@stgolabs.net>
It is well known that because the mm can internally
call the regular gup_unlocked if the lockless approach
fails and take the sem there, the caller must not hold
the mmap_sem already.
Fixes: e523f289fe4d (MIPS: c-r4k: Fix sigtramp SMP call to use kmap)
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Paul Burton <paul.burton@mips.com>
Cc: James Hogan <jhogan@kernel.org>
Cc: linux-mips@vger.kernel.org
Signed-off-by: Davidlohr Bueso <dbueso@suse.de>
---
arch/mips/mm/c-r4k.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/arch/mips/mm/c-r4k.c b/arch/mips/mm/c-r4k.c
index cc4e17caeb26..38fe86928837 100644
--- a/arch/mips/mm/c-r4k.c
+++ b/arch/mips/mm/c-r4k.c
@@ -1034,11 +1034,9 @@ static void r4k_flush_cache_sigtramp(unsigned long addr)
struct flush_cache_sigtramp_args args;
int npages;
- down_read(¤t->mm->mmap_sem);
-
npages = get_user_pages_fast(addr, 1, 0, &args.page);
if (npages < 1)
- goto out;
+ return;
args.mm = current->mm;
args.addr = addr;
@@ -1046,8 +1044,6 @@ static void r4k_flush_cache_sigtramp(unsigned long addr)
r4k_on_each_cpu(R4K_HIT, local_r4k_flush_cache_sigtramp, &args);
put_page(args.page);
-out:
- up_read(¤t->mm->mmap_sem);
}
static void r4k_flush_icache_all(void)
--
2.16.4
next prev parent reply other threads:[~2019-02-07 5:38 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-07 5:37 [PATCH -tip 0/2] more get_user_pages mmap_sem cleanups Davidlohr Bueso
2019-02-07 5:37 ` [PATCH 1/2] xsk: do not use mmap_sem Davidlohr Bueso
2019-02-07 7:43 ` Björn Töpel
2019-02-11 15:33 ` Daniel Borkmann
2019-02-11 16:37 ` Dan Williams
2019-02-11 17:16 ` Weiny, Ira
2019-02-11 16:15 ` [PATCH v2] xsk: share the mmap_sem for page pinning Davidlohr Bueso
2019-02-11 16:21 ` Björn Töpel
2019-02-11 19:53 ` Daniel Borkmann
2019-02-07 5:37 ` Davidlohr Bueso [this message]
2019-02-07 19:00 ` [PATCH 2/2] MIPS/c-r4k: do no use mmap_sem for gup_fast() Paul Burton
2019-02-07 19:25 ` Davidlohr Bueso
2019-02-07 5:50 ` [PATCH -tip 0/2] more get_user_pages mmap_sem cleanups Davidlohr Bueso
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190207053740.26915-3-dave@stgolabs.net \
--to=dave@stgolabs.net \
--cc=akpm@linux-foundation.org \
--cc=dbueso@suse.de \
--cc=jhogan@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=paul.burton@mips.com \
--cc=ralf@linux-mips.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).