linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Nadav Amit <nadav.amit@gmail.com>
To: Mel Gorman <mgorman@suse.de>
Cc: "open list:MEMORY MANAGEMENT" <linux-mm@kvack.org>,
	Sergey Senozhatsky <sergey.senozhatsky@gmail.com>,
	Minchan Kim <minchan@kernel.org>, Rik van Riel <riel@redhat.com>,
	luto@kernel.org
Subject: Re: [PATCH v3 2/2] mm: migrate: fix barriers around tlb_flush_pending
Date: Fri, 28 Jul 2017 09:40:24 -0700	[thread overview]
Message-ID: <4F474FD8-82BE-4881-AE47-40AA6A4091C1@gmail.com> (raw)
In-Reply-To: <20170728074256.7xsnoldtfuh7ywir@suse.de>

Mel Gorman <mgorman@suse.de> wrote:

> On Thu, Jul 27, 2017 at 04:40:15AM -0700, Nadav Amit wrote:
>> Reading tlb_flush_pending while the page-table lock is taken does not
>> require a barrier, since the lock/unlock already acts as a barrier.
>> Removing the barrier in mm_tlb_flush_pending() to address this issue.
>> 
>> However, migrate_misplaced_transhuge_page() calls mm_tlb_flush_pending()
>> while the page-table lock is already released, which may present a
>> problem on architectures with weak memory model (PPC). To deal with this
>> case, a new parameter is added to mm_tlb_flush_pending() to indicate
>> if it is read without the page-table lock taken, and calling
>> smp_mb__after_unlock_lock() in this case.
>> 
>> Signed-off-by: Nadav Amit <namit@vmware.com>
> 
> Conditional locking based on function arguements are often considered
> extremely hazardous. Conditional barriers are even more troublesome because
> it's simply too easy to get wrong.
> 
> Revert b0943d61b8fa420180f92f64ef67662b4f6cc493 instead of this patch. It's
> not a clean revert but conflicts are due to comment changes. It moves
> the check back under the PTL and the impact is marginal given that
> it a spurious TLB flush will only occur when potentially racing with
> change_prot_range. Since that commit went in, a lot of changes have happened
> that alter the scan rate of automatic NUMA balancing so it shouldn't be a
> serious issue. It's certainly a nicer option than using conditional barriers.

Ok. Initially, I added a memory barrier only in
migrate_misplaced_transhuge_page(), and included a detailed comment about it
- I still think it is better. But since you feel confident the impact will
be relatively small, I will do the revert.


--
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>

      reply	other threads:[~2017-07-28 16:40 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-27 11:40 [PATCH v3 0/2] mm: fixes of tlb_flush_pending races Nadav Amit
2017-07-27 11:40 ` [PATCH v3 1/2] mm: migrate: prevent racy access to tlb_flush_pending Nadav Amit
2017-07-28  1:34   ` Sergey Senozhatsky
2017-07-28  1:44     ` Nadav Amit
2017-07-28  1:42   ` Sergey Senozhatsky
2017-07-28  2:28   ` Rik van Riel
2017-07-27 11:40 ` [PATCH v3 2/2] mm: migrate: fix barriers around tlb_flush_pending Nadav Amit
2017-07-28  7:42   ` Mel Gorman
2017-07-28 16:40     ` Nadav Amit [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=4F474FD8-82BE-4881-AE47-40AA6A4091C1@gmail.com \
    --to=nadav.amit@gmail.com \
    --cc=linux-mm@kvack.org \
    --cc=luto@kernel.org \
    --cc=mgorman@suse.de \
    --cc=minchan@kernel.org \
    --cc=riel@redhat.com \
    --cc=sergey.senozhatsky@gmail.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