All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Kirill A. Shutemov" <kirill@shutemov.name>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
	Andrea Arcangeli <aarcange@redhat.com>,
	Mel Gorman <mgorman@techsingularity.net>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mprotect: drop overprotective lock_pte_protection()
Date: Wed, 8 Feb 2017 15:04:21 +0300	[thread overview]
Message-ID: <20170208120421.GE5578@node.shutemov.name> (raw)
In-Reply-To: <20170207134454.7af755ae379ca9d016b5c15a@linux-foundation.org>

On Tue, Feb 07, 2017 at 01:44:54PM -0800, Andrew Morton wrote:
> On Tue,  7 Feb 2017 17:33:47 +0300 "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com> wrote:
> 
> > lock_pte_protection() uses pmd_lock() to make sure that we have stable
> > PTE page table before walking pte range.
> > 
> > That's not necessary. We only need to make sure that PTE page table is
> > established. It cannot vanish under us as long as we hold mmap_sem at
> > least for read.
> > 
> > And we already have helper for that -- pmd_trans_unstable().
> 
> http://ozlabs.org/~akpm/mmots/broken-out/mm-mprotect-use-pmd_trans_unstable-instead-of-taking-the-pmd_lock.patch
> already did this?

Right. Except, it doesn't drop unneeded pmd_trans_unstable(pmd) check after
__split_huge_pmd().

Could you fold this part of my patch into Andrea's?

diff --git a/mm/mprotect.c b/mm/mprotect.c
index f9c07f54dd62..e919e4613eab 100644
--- a/mm/mprotect.c
+++ b/mm/mprotect.c
@@ -177,8 +149,6 @@ static inline unsigned long change_pmd_range(struct vm_area_struct *vma,
 		if (pmd_trans_huge(*pmd) || pmd_devmap(*pmd)) {
 			if (next - addr != HPAGE_PMD_SIZE) {
 				__split_huge_pmd(vma, pmd, addr, false, NULL);
-				if (pmd_trans_unstable(pmd))
-					continue;
 			} else {
 				int nr_ptes = change_huge_pmd(vma, pmd, addr,
 						newprot, prot_numa);
-- 
 Kirill A. Shutemov

WARNING: multiple messages have this Message-ID
From: "Kirill A. Shutemov" <kirill@shutemov.name>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
	Andrea Arcangeli <aarcange@redhat.com>,
	Mel Gorman <mgorman@techsingularity.net>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mprotect: drop overprotective lock_pte_protection()
Date: Wed, 8 Feb 2017 15:04:21 +0300	[thread overview]
Message-ID: <20170208120421.GE5578@node.shutemov.name> (raw)
In-Reply-To: <20170207134454.7af755ae379ca9d016b5c15a@linux-foundation.org>

On Tue, Feb 07, 2017 at 01:44:54PM -0800, Andrew Morton wrote:
> On Tue,  7 Feb 2017 17:33:47 +0300 "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com> wrote:
> 
> > lock_pte_protection() uses pmd_lock() to make sure that we have stable
> > PTE page table before walking pte range.
> > 
> > That's not necessary. We only need to make sure that PTE page table is
> > established. It cannot vanish under us as long as we hold mmap_sem at
> > least for read.
> > 
> > And we already have helper for that -- pmd_trans_unstable().
> 
> http://ozlabs.org/~akpm/mmots/broken-out/mm-mprotect-use-pmd_trans_unstable-instead-of-taking-the-pmd_lock.patch
> already did this?

Right. Except, it doesn't drop unneeded pmd_trans_unstable(pmd) check after
__split_huge_pmd().

Could you fold this part of my patch into Andrea's?

diff --git a/mm/mprotect.c b/mm/mprotect.c
index f9c07f54dd62..e919e4613eab 100644
--- a/mm/mprotect.c
+++ b/mm/mprotect.c
@@ -177,8 +149,6 @@ static inline unsigned long change_pmd_range(struct vm_area_struct *vma,
 		if (pmd_trans_huge(*pmd) || pmd_devmap(*pmd)) {
 			if (next - addr != HPAGE_PMD_SIZE) {
 				__split_huge_pmd(vma, pmd, addr, false, NULL);
-				if (pmd_trans_unstable(pmd))
-					continue;
 			} else {
 				int nr_ptes = change_huge_pmd(vma, pmd, addr,
 						newprot, prot_numa);
-- 
 Kirill A. Shutemov

--
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-02-08 12:04 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-07 14:33 Kirill A. Shutemov
2017-02-07 14:33 ` Kirill A. Shutemov
2017-02-07 21:29 ` Andrea Arcangeli
2017-02-07 21:29   ` Andrea Arcangeli
2017-02-07 21:44 ` Andrew Morton
2017-02-07 21:44   ` Andrew Morton
2017-02-08 12:04   ` Kirill A. Shutemov [this message]
2017-02-08 12:04     ` Kirill A. Shutemov
2017-02-08 13:45     ` Andrea Arcangeli
2017-02-08 13:45       ` Andrea Arcangeli

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=20170208120421.GE5578@node.shutemov.name \
    --to=kirill@shutemov.name \
    --cc=aarcange@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mgorman@techsingularity.net \
    --subject='Re: [PATCH] mprotect: drop overprotective lock_pte_protection()' \
    /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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.