From: Mel Gorman <mgorman@suse.de>
To: Nadav Amit <nadav.amit@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Nadav Amit <namit@vmware.com>,
"open list:MEMORY MANAGEMENT" <linux-mm@kvack.org>,
Rik van Riel <riel@redhat.com>, Andy Lutomirski <luto@kernel.org>
Subject: Re: [PATCH] mm: Prevent racy access to tlb_flush_pending
Date: Tue, 25 Jul 2017 10:49:15 +0100 [thread overview]
Message-ID: <20170725094915.uldl43aazfbvdl7f@suse.de> (raw)
In-Reply-To: <1A44338A-C667-4D63-A93F-EBBF6C9226D2@gmail.com>
On Mon, Jul 24, 2017 at 05:27:47PM -0700, Nadav Amit wrote:
> > Do we still need the barrier()s or is it OK to let the atomic op do
> > that for us (with a suitable code comment).
>
> I will submit v2. However, I really don???t understand the comment on
> mm_tlb_flush_pending():
>
> /*
> * Memory barriers to keep this state in sync are graciously provided by
> * the page table locks, outside of which no page table modifications happen.
> * The barriers below prevent the compiler from re-ordering the instructions
> * around the memory barriers that are already present in the code.
> */
>
> But IIUC migrate_misplaced_transhuge_page() does not call
> mm_tlb_flush_pending() while the ptl is taken.
>
> Mel, can I bother you again? Should I move the flush in
> migrate_misplaced_transhuge_page() till after the ptl is taken?
>
The flush, if it's necessary, needs to happen before the copy. However,
in this particular context it shouldn't matter. In this specific context,
we must be dealing with a NUMA hinting fault which means the original PTE
is PROT_NONE, flushed and no writes are possible. If a protection update
happens during the copy in migrate_misplaced_transhuge_page then it'll
be detected in migrate_misplaced_transhuge_page by the pmd_same check and
the page copy was a waste of time but otherwise harmless.
--
Mel Gorman
SUSE Labs
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
prev parent reply other threads:[~2017-07-25 9:49 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-17 18:02 Nadav Amit
2017-07-18 1:31 ` Andy Lutomirski
2017-07-18 1:40 ` Nadav Amit
2017-07-18 4:52 ` Andy Lutomirski
2017-07-18 5:11 ` Nadav Amit
2017-07-24 19:50 ` Nadav Amit
2017-07-24 23:54 ` Andrew Morton
2017-07-25 0:27 ` Nadav Amit
2017-07-25 0:33 ` Nadav Amit
2017-07-25 9:49 ` Mel Gorman [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=20170725094915.uldl43aazfbvdl7f@suse.de \
--to=mgorman@suse.de \
--cc=akpm@linux-foundation.org \
--cc=linux-mm@kvack.org \
--cc=luto@kernel.org \
--cc=nadav.amit@gmail.com \
--cc=namit@vmware.com \
--cc=riel@redhat.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