From: Andrea Arcangeli <aarcange@redhat.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-mm@kvack.org, zhong jiang <zhongjiang@huawei.com>,
syzkaller-bugs@googlegroups.com,
syzbot+cbb52e396df3e565ab02@syzkaller.appspotmail.com,
Mike Rapoport <rppt@linux.vnet.ibm.com>,
Mike Kravetz <mike.kravetz@oracle.com>,
Peter Xu <peterx@redhat.com>, Dmitry Vyukov <dvyukov@google.com>
Subject: [PATCH 2/2] mm: change mm_update_next_owner() to update mm->owner with WRITE_ONCE
Date: Mon, 25 Mar 2019 18:56:36 -0400 [thread overview]
Message-ID: <20190325225636.11635-3-aarcange@redhat.com> (raw)
In-Reply-To: <20190325225636.11635-1-aarcange@redhat.com>
The RCU reader uses rcu_dereference() inside rcu_read_lock critical
sections, so the writer shall use WRITE_ONCE. Just a cleanup, we still
rely on gcc to emit atomic writes in other places.
Signed-off-by: Andrea Arcangeli <aarcange@redhat.com>
---
kernel/exit.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/kernel/exit.c b/kernel/exit.c
index 2166c2d92ddc..8361a560cd1d 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -422,7 +422,7 @@ void mm_update_next_owner(struct mm_struct *mm)
* freed task structure.
*/
if (atomic_read(&mm->mm_users) <= 1) {
- mm->owner = NULL;
+ WRITE_ONCE(mm->owner, NULL);
return;
}
@@ -462,7 +462,7 @@ void mm_update_next_owner(struct mm_struct *mm)
* most likely racing with swapoff (try_to_unuse()) or /proc or
* ptrace or page migration (get_task_mm()). Mark owner as NULL.
*/
- mm->owner = NULL;
+ WRITE_ONCE(mm->owner, NULL);
return;
assign_new_owner:
@@ -483,7 +483,7 @@ void mm_update_next_owner(struct mm_struct *mm)
put_task_struct(c);
goto retry;
}
- mm->owner = c;
+ WRITE_ONCE(mm->owner, c);
task_unlock(c);
put_task_struct(c);
}
prev parent reply other threads:[~2019-03-25 22:56 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-25 22:56 [PATCH 0/2] userfaultfd: use RCU to free the task struct when fork fails Andrea Arcangeli
2019-03-25 22:56 ` [PATCH 1/2] " Andrea Arcangeli
2019-03-26 8:07 ` Kirill Tkhai
2019-03-26 8:18 ` Kirill Tkhai
2019-03-26 8:19 ` Kirill Tkhai
2019-03-26 8:56 ` Michal Hocko
2019-03-27 0:16 ` Andrea Arcangeli
2019-03-27 8:49 ` Michal Hocko
2019-04-26 4:48 ` Andrew Morton
2019-04-29 3:57 ` [PATCH 1/1 v2] " Andrea Arcangeli
2019-04-29 6:36 ` zhong jiang
2019-04-29 14:37 ` Andrea Arcangeli
2019-03-25 22:56 ` Andrea Arcangeli [this message]
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=20190325225636.11635-3-aarcange@redhat.com \
--to=aarcange@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=dvyukov@google.com \
--cc=linux-mm@kvack.org \
--cc=mike.kravetz@oracle.com \
--cc=peterx@redhat.com \
--cc=rppt@linux.vnet.ibm.com \
--cc=syzbot+cbb52e396df3e565ab02@syzkaller.appspotmail.com \
--cc=syzkaller-bugs@googlegroups.com \
--cc=zhongjiang@huawei.com \
/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