linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Michal Hocko <mhocko@kernel.org>
To: Nitin Gupta <nitingupta910@gmail.com>
Cc: steven.sistare@oracle.com,
	"Nitin Gupta" <nitin.m.gupta@oracle.com>,
	"Andrew Morton" <akpm@linux-foundation.org>,
	"Ingo Molnar" <mingo@kernel.org>, "Mel Gorman" <mgorman@suse.de>,
	"Nadav Amit" <namit@vmware.com>,
	"Minchan Kim" <minchan@kernel.org>,
	"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
	"Peter Zijlstra" <peterz@infradead.org>,
	"Vegard Nossum" <vegard.nossum@oracle.com>,
	"Levin, Alexander (Sasha Levin)" <alexander.levin@verizon.com>,
	"Mike Rapoport" <rppt@linux.vnet.ibm.com>,
	"Hillf Danton" <hillf.zj@alibaba-inc.com>,
	"Shaohua Li" <shli@fb.com>,
	"Anshuman Khandual" <khandual@linux.vnet.ibm.com>,
	"Andrea Arcangeli" <aarcange@redhat.com>,
	"David Rientjes" <rientjes@google.com>,
	"Rik van Riel" <riel@redhat.com>, "Jan Kara" <jack@suse.cz>,
	"Dave Jiang" <dave.jiang@intel.com>,
	"Jérôme Glisse" <jglisse@redhat.com>,
	"Matthew Wilcox" <willy@linux.intel.com>,
	"Ross Zwisler" <ross.zwisler@linux.intel.com>,
	"Hugh Dickins" <hughd@google.com>,
	"Tobin C Harding" <me@tobin.cc>,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [PATCH v2] mm: Reduce memory bloat with THP
Date: Fri, 19 Jan 2018 13:49:57 +0100	[thread overview]
Message-ID: <20180119124957.GA6584@dhcp22.suse.cz> (raw)
In-Reply-To: <1516318444-30868-1-git-send-email-nitingupta910@gmail.com>

On Thu 18-01-18 15:33:16, Nitin Gupta wrote:
> From: Nitin Gupta <nitin.m.gupta@oracle.com>
> 
> Currently, if the THP enabled policy is "always", or the mode
> is "madvise" and a region is marked as MADV_HUGEPAGE, a hugepage
> is allocated on a page fault if the pud or pmd is empty.  This
> yields the best VA translation performance, but increases memory
> consumption if some small page ranges within the huge page are
> never accessed.

Yes, this is true but hardly unexpected for MADV_HUGEPAGE or THP always
users.
 
> An alternate behavior for such page faults is to install a
> hugepage only when a region is actually found to be (almost)
> fully mapped and active.  This is a compromise between
> translation performance and memory consumption.  Currently there
> is no way for an application to choose this compromise for the
> page fault conditions above.

Is that really true? We have /sys/kernel/mm/transparent_hugepage/khugepaged/max_ptes_none
This is not reflected during the PF of course but you can control the
behavior there as well. Either by the global setting or a per proces
prctl.

> With this change, whenever an application issues MADV_DONTNEED on a
> memory region, the region is marked as "space-efficient". For such
> regions, a hugepage is not immediately allocated on first write.

Kirill didn't like it in the previous version and I do not like this
either. You are adding a very subtle side effect which might completely
unexpected. Consider userspace memory allocator which uses MADV_DONTNEED
to free up unused memory. Now you have put it out of THP usage
basically.

If the memory is used really scarce then we have MADV_NOHUGEPAGE.
-- 
Michal Hocko
SUSE Labs

--
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:[~2018-01-19 12:50 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-18 23:33 [PATCH v2] mm: Reduce memory bloat with THP Nitin Gupta
2018-01-19 12:49 ` Michal Hocko [this message]
2018-01-19 20:59   ` Nitin Gupta
2018-01-25  0:47     ` Zi Yan
2018-01-25 19:41       ` Nitin Gupta
2018-01-25 21:13         ` Mel Gorman
2018-02-01  1:09           ` Nitin Gupta
2018-02-01 10:09             ` Mel Gorman
2018-02-01 10:27           ` Kirill A. Shutemov
2018-02-01 10:46             ` Mel Gorman
2018-01-25 22:29         ` Andrea Arcangeli
2018-01-25  9:58     ` Michal Hocko
2018-01-25 22:40       ` 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=20180119124957.GA6584@dhcp22.suse.cz \
    --to=mhocko@kernel.org \
    --cc=aarcange@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=alexander.levin@verizon.com \
    --cc=dave.jiang@intel.com \
    --cc=hillf.zj@alibaba-inc.com \
    --cc=hughd@google.com \
    --cc=jack@suse.cz \
    --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=me@tobin.cc \
    --cc=mgorman@suse.de \
    --cc=minchan@kernel.org \
    --cc=mingo@kernel.org \
    --cc=namit@vmware.com \
    --cc=nitin.m.gupta@oracle.com \
    --cc=nitingupta910@gmail.com \
    --cc=peterz@infradead.org \
    --cc=riel@redhat.com \
    --cc=rientjes@google.com \
    --cc=ross.zwisler@linux.intel.com \
    --cc=rppt@linux.vnet.ibm.com \
    --cc=shli@fb.com \
    --cc=steven.sistare@oracle.com \
    --cc=vegard.nossum@oracle.com \
    --cc=willy@linux.intel.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).