All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Kirill A. Shutemov" <kirill@shutemov.name>
To: Rik van Riel <riel@redhat.com>
Cc: Ebru Akagunduz <ebru.akagunduz@gmail.com>,
	linux-mm@kvack.org, akpm@linux-foundation.org, mhocko@suse.cz,
	mgorman@suse.de, rientjes@google.com, sasha.levin@oracle.com,
	hughd@google.com, hannes@cmpxchg.org, vbabka@suse.cz,
	linux-kernel@vger.kernel.org, aarcange@redhat.com
Subject: Re: [PATCH] mm: incorporate read-only pages into transparent huge pages
Date: Fri, 23 Jan 2015 17:58:02 +0200	[thread overview]
Message-ID: <20150123155802.GA7011@node.dhcp.inet.fi> (raw)
In-Reply-To: <54C2613F.6080403@redhat.com>

On Fri, Jan 23, 2015 at 09:57:03AM -0500, Rik van Riel wrote:
> On 01/23/2015 06:37 AM, Kirill A. Shutemov wrote:
> > On Fri, Jan 23, 2015 at 09:47:36AM +0200, Ebru Akagunduz wrote:
> >> This patch aims to improve THP collapse rates, by allowing
> >> THP collapse in the presence of read-only ptes, like those
> >> left in place by do_swap_page after a read fault.
> >>
> >> Currently THP can collapse 4kB pages into a THP when
> >> there are up to khugepaged_max_ptes_none pte_none ptes
> >> in a 2MB range. This patch applies the same limit for
> >> read-only ptes.
> 
> >> @@ -2179,6 +2179,17 @@ static int __collapse_huge_page_isolate(struct vm_area_struct *vma,
> >>  		 */
> >>  		if (!trylock_page(page))
> >>  			goto out;
> >> +		if (!pte_write(pteval)) {
> >> +			if (PageSwapCache(page) && !reuse_swap_page(page)) {
> >> +					unlock_page(page);
> >> +					goto out;
> >> +			}
> >> +			/*
> >> +			 * Page is not in the swap cache, and page count is
> >> +			 * one (see above). It can be collapsed into a THP.
> >> +			 */
> >> +		}
> > 
> > Hm. As a side effect it will effectevely allow collapse in PROT_READ vmas,
> > right? I'm not convinced it's a good idea.
> 
> It will only allow a THP collapse if there is at least one
> read-write pte.
> 
> I suspect that excludes read-only VMAs automatically.

Ah. Okay. I missed that condition.

Looks good to me.

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

WARNING: multiple messages have this Message-ID (diff)
From: "Kirill A. Shutemov" <kirill@shutemov.name>
To: Rik van Riel <riel@redhat.com>
Cc: Ebru Akagunduz <ebru.akagunduz@gmail.com>,
	linux-mm@kvack.org, akpm@linux-foundation.org, mhocko@suse.cz,
	mgorman@suse.de, rientjes@google.com, sasha.levin@oracle.com,
	hughd@google.com, hannes@cmpxchg.org, vbabka@suse.cz,
	linux-kernel@vger.kernel.org, aarcange@redhat.com
Subject: Re: [PATCH] mm: incorporate read-only pages into transparent huge pages
Date: Fri, 23 Jan 2015 17:58:02 +0200	[thread overview]
Message-ID: <20150123155802.GA7011@node.dhcp.inet.fi> (raw)
In-Reply-To: <54C2613F.6080403@redhat.com>

On Fri, Jan 23, 2015 at 09:57:03AM -0500, Rik van Riel wrote:
> On 01/23/2015 06:37 AM, Kirill A. Shutemov wrote:
> > On Fri, Jan 23, 2015 at 09:47:36AM +0200, Ebru Akagunduz wrote:
> >> This patch aims to improve THP collapse rates, by allowing
> >> THP collapse in the presence of read-only ptes, like those
> >> left in place by do_swap_page after a read fault.
> >>
> >> Currently THP can collapse 4kB pages into a THP when
> >> there are up to khugepaged_max_ptes_none pte_none ptes
> >> in a 2MB range. This patch applies the same limit for
> >> read-only ptes.
> 
> >> @@ -2179,6 +2179,17 @@ static int __collapse_huge_page_isolate(struct vm_area_struct *vma,
> >>  		 */
> >>  		if (!trylock_page(page))
> >>  			goto out;
> >> +		if (!pte_write(pteval)) {
> >> +			if (PageSwapCache(page) && !reuse_swap_page(page)) {
> >> +					unlock_page(page);
> >> +					goto out;
> >> +			}
> >> +			/*
> >> +			 * Page is not in the swap cache, and page count is
> >> +			 * one (see above). It can be collapsed into a THP.
> >> +			 */
> >> +		}
> > 
> > Hm. As a side effect it will effectevely allow collapse in PROT_READ vmas,
> > right? I'm not convinced it's a good idea.
> 
> It will only allow a THP collapse if there is at least one
> read-write pte.
> 
> I suspect that excludes read-only VMAs automatically.

Ah. Okay. I missed that condition.

Looks good to me.

-- 
 Kirill A. Shutemov

  reply	other threads:[~2015-01-23 15:58 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-23  7:47 [PATCH] mm: incorporate read-only pages into transparent huge pages Ebru Akagunduz
2015-01-23  7:47 ` Ebru Akagunduz
2015-01-23 11:37 ` Kirill A. Shutemov
2015-01-23 11:37   ` Kirill A. Shutemov
2015-01-23 14:57   ` Rik van Riel
2015-01-23 14:57     ` Rik van Riel
2015-01-23 15:58     ` Kirill A. Shutemov [this message]
2015-01-23 15:58       ` Kirill A. Shutemov
2015-01-23 16:12 ` Vlastimil Babka
2015-01-23 16:12   ` Vlastimil Babka
2015-01-23 16:15   ` Rik van Riel
2015-01-23 16:15     ` Rik van Riel
2015-01-23 19:04 ` Rik van Riel
2015-01-23 19:04   ` Rik van Riel
2015-01-23 19:18 ` Andrea Arcangeli
2015-01-23 19:18   ` Andrea Arcangeli
2015-01-25  9:25   ` Vlastimil Babka
2015-01-25  9:25     ` Vlastimil Babka
2015-01-25 14:42     ` Zhang Yanfei
2015-01-25 14:42       ` Zhang Yanfei

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=20150123155802.GA7011@node.dhcp.inet.fi \
    --to=kirill@shutemov.name \
    --cc=aarcange@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=ebru.akagunduz@gmail.com \
    --cc=hannes@cmpxchg.org \
    --cc=hughd@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mgorman@suse.de \
    --cc=mhocko@suse.cz \
    --cc=riel@redhat.com \
    --cc=rientjes@google.com \
    --cc=sasha.levin@oracle.com \
    --cc=vbabka@suse.cz \
    /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 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.