From: "Kirill A. Shutemov" <kirill@shutemov.name>
To: Zi Yan <zi.yan@cs.rutgers.edu>
Cc: Mel Gorman <mgorman@techsingularity.net>,
Anthony Yznaga <anthony.yznaga@oracle.com>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
aarcange@redhat.com, aneesh.kumar@linux.ibm.com,
akpm@linux-foundation.org, jglisse@redhat.com,
khandual@linux.vnet.ibm.com, kirill.shutemov@linux.intel.com,
mhocko@kernel.org, minchan@kernel.org, peterz@infradead.org,
rientjes@google.com, vbabka@suse.cz, willy@infradead.org,
ying.huang@intel.com, nitingupta910@gmail.com
Subject: Re: [RFC PATCH] mm: thp: implement THP reservations for anonymous memory
Date: Sat, 10 Nov 2018 12:35:34 +0300 [thread overview]
Message-ID: <20181110093534.upaq6tfxxtoquq3p@kshutemo-mobl1> (raw)
In-Reply-To: <EEBCAF4D-138C-4CF7-B4B7-C55F1192A026@cs.rutgers.edu>
On Fri, Nov 09, 2018 at 10:34:07AM -0500, Zi Yan wrote:
> On 9 Nov 2018, at 8:11, Mel Gorman wrote:
>
> > On Fri, Nov 09, 2018 at 03:13:18PM +0300, Kirill A. Shutemov wrote:
> >> On Thu, Nov 08, 2018 at 10:48:58PM -0800, Anthony Yznaga wrote:
> >>> The basic idea as outlined by Mel Gorman in [2] is:
> >>>
> >>> 1) On first fault in a sufficiently sized range, allocate a huge page
> >>> sized and aligned block of base pages. Map the base page
> >>> corresponding to the fault address and hold the rest of the pages in
> >>> reserve.
> >>> 2) On subsequent faults in the range, map the pages from the reservation.
> >>> 3) When enough pages have been mapped, promote the mapped pages and
> >>> remaining pages in the reservation to a huge page.
> >>> 4) When there is memory pressure, release the unused pages from their
> >>> reservations.
> >>
> >> I haven't yet read the patch in details, but I'm skeptical about the
> >> approach in general for few reasons:
> >>
> >> - PTE page table retracting to replace it with huge PMD entry requires
> >> down_write(mmap_sem). It makes the approach not practical for many
> >> multi-threaded workloads.
> >>
> >> I don't see a way to avoid exclusive lock here. I will be glad to
> >> be proved otherwise.
> >>
> >
> > That problem is somewhat fundamental to the mmap_sem itself and
> > conceivably it could be alleviated by range-locking (if that gets
> > completed). The other thing to bear in mind is the timing. If the
> > promotion is in-place due to reservations, there isn't the allocation
> > overhead and the hold times *should* be short.
> >
>
> Is it possible to convert all these PTEs to migration entries during
> the promotion and replace them with a huge PMD entry afterwards?
> AFAIK, migrating pages does not require holding a mmap_sem.
> Basically, it will act like migrating 512 base pages to a THP without
> actually doing the page copy.
You'll still need down_write(mmap_sem) to convert PTE page table full of
migration entires to PMD entry. It's required at least to protect against
parallel MADV_DONTNEED that can zap migration entries under you.
--
Kirill A. Shutemov
next prev parent reply other threads:[~2018-11-10 9:35 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-09 6:48 Anthony Yznaga
2018-11-09 11:07 ` Mel Gorman
2018-11-09 23:37 ` anthony.yznaga
2018-11-09 12:13 ` Kirill A. Shutemov
2018-11-09 13:11 ` Mel Gorman
2018-11-09 15:34 ` Zi Yan
2018-11-10 0:39 ` anthony.yznaga
2018-11-10 9:35 ` Kirill A. Shutemov [this message]
2018-11-09 19:51 ` Andrea Arcangeli
2018-11-10 0:55 ` anthony.yznaga
2018-11-10 13:22 ` Mel Gorman
2018-11-10 16:44 ` Andrea Arcangeli
2018-11-14 23:15 ` anthony.yznaga
2019-01-25 2:28 ` Anthony Yznaga
2018-11-20 9:11 ` Kirill A. Shutemov
2018-11-20 17:04 ` Andrea Arcangeli
2018-11-10 0:04 ` anthony.yznaga
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=20181110093534.upaq6tfxxtoquq3p@kshutemo-mobl1 \
--to=kirill@shutemov.name \
--cc=aarcange@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=aneesh.kumar@linux.ibm.com \
--cc=anthony.yznaga@oracle.com \
--cc=jglisse@redhat.com \
--cc=khandual@linux.vnet.ibm.com \
--cc=kirill.shutemov@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mgorman@techsingularity.net \
--cc=mhocko@kernel.org \
--cc=minchan@kernel.org \
--cc=nitingupta910@gmail.com \
--cc=peterz@infradead.org \
--cc=rientjes@google.com \
--cc=vbabka@suse.cz \
--cc=willy@infradead.org \
--cc=ying.huang@intel.com \
--cc=zi.yan@cs.rutgers.edu \
/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