linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Mike Kravetz <mike.kravetz@oracle.com>
To: "裘稀石(稀石)" <xishi.qiuxishi@alibaba-inc.com>,
	linux-mm <linux-mm@kvack.org>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	ltp <ltp@lists.linux.it>
Cc: Li Wang <liwang@redhat.com>,
	Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>,
	Michal Hocko <mhocko@kernel.org>, Cyril Hrubis <chrubis@suse.cz>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH] hugetlbfs: fix hugetlb page migration/fault race causing SIGBUS
Date: Wed, 7 Aug 2019 19:44:47 -0700	[thread overview]
Message-ID: <5f072c20-2396-48ee-700a-ea7eafc20328@oracle.com> (raw)
In-Reply-To: <f7a64f0a-1ae0-4582-a293-b608bc8fed36.xishi.qiuxishi@alibaba-inc.com>

On 8/7/19 7:24 PM, 裘稀石(稀石) wrote:
> Hi Mike,
> 
> Do you mean the similar race is like the following?
> 
> migration clearing the pte
>   page fault(before we return error, and now we return 0, then try page fault again, right?)
>     migration writing a migration entry

Yes, something like the that.  The change is to takes the page table lock
to examine the pte before returning.  If the pte is clear when examined
while holding the lock, an error will be returned as before.  If not clear,
then we return zero and try again.

This change adds code which is very much like this check further in
the routine hugetlb_no_page():

	ptl = huge_pte_lock(h, mm, ptep);
	size = i_size_read(mapping->host) >> huge_page_shift(h);
	if (idx >= size)
		goto backout;

	ret = 0;
	if (!huge_pte_none(huge_ptep_get(ptep)))
		goto backout;

-- 
Mike Kravetz


  reply	other threads:[~2019-08-08  2:47 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-08  2:24 [PATCH] hugetlbfs: fix hugetlb page migration/fault race causing SIGBUS 裘稀石(稀石)
2019-08-08  2:44 ` Mike Kravetz [this message]
  -- strict thread matches above, loose matches on Subject: below --
2019-08-08  0:05 Mike Kravetz
2019-08-08  3:36 ` Naoya Horiguchi
2019-08-08  7:46 ` Michal Hocko
2019-08-08  7:47   ` Michal Hocko
2019-08-08 16:55     ` Mike Kravetz
2019-08-08 18:53       ` Michal Hocko
2019-08-08 23:39         ` Andrew Morton
2019-08-09  6:46           ` Michal Hocko
2019-08-09 22:17             ` Andrew Morton
2019-08-11 23:46               ` Sasha Levin
2019-08-12  8:45                 ` Michal Hocko
2019-08-12 13:14                   ` Vlastimil Babka
2019-08-12 13:22                     ` Michal Hocko
2019-08-12 15:33                       ` Sasha Levin
2019-08-12 16:09                         ` Qian Cai
2019-08-12 21:37                         ` Andrew Morton
2019-08-13  8:43                         ` Michal Hocko

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=5f072c20-2396-48ee-700a-ea7eafc20328@oracle.com \
    --to=mike.kravetz@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=chrubis@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=liwang@redhat.com \
    --cc=ltp@lists.linux.it \
    --cc=mhocko@kernel.org \
    --cc=n-horiguchi@ah.jp.nec.com \
    --cc=xishi.qiuxishi@alibaba-inc.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;
as well as URLs for NNTP newsgroup(s).