linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "Kirill A. Shutemov" <kirill@shutemov.name>
To: Matthew Wilcox <willy@infradead.org>
Cc: linux-mm@kvack.org
Subject: Re: Consolidate calls to unmap_mapping_range in collapse_shmem
Date: Wed, 29 Mar 2017 14:06:35 +0300	[thread overview]
Message-ID: <20170329110635.fqgspc7sr5pgqohr@node.shutemov.name> (raw)
In-Reply-To: <20170329021503.GA7760@bombadil.infradead.org>

On Tue, Mar 28, 2017 at 07:15:03PM -0700, Matthew Wilcox wrote:
> 
> Is there a reason we call unmap_mapping_range() for a single page at a
> time instead of the entire hugepage?  This is surely more efficient ...
> but does it do something like increase the refcount on the page?

Yes, mapcount holds refcount on the page. So page_ref_freeze() will fail
with proposed change.

> I suppose we might be able to skip all the calls to unmap_mapping_range()
> if none of the pages are mapped, but surely anonymous pages are usually
> mapped?

The valid optimization I *think* would be to call unmap_mapping_range()
for whole huge page range before iterating over individual pages. This way
we would only hit page_mapped() case if there was race with page fault.

P.S. proper To/Cc would helped me to notice it. :)

-- 
 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-03-29 11:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-29  2:15 Matthew Wilcox
2017-03-29 11:06 ` Kirill A. Shutemov [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=20170329110635.fqgspc7sr5pgqohr@node.shutemov.name \
    --to=kirill@shutemov.name \
    --cc=linux-mm@kvack.org \
    --cc=willy@infradead.org \
    /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