linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "Zi Yan" <zi.yan@cs.rutgers.edu>
To: Nitin Gupta <nitin.m.gupta@oracle.com>
Cc: "Michal Hocko" <mhocko@kernel.org>,
	"Nitin Gupta" <nitingupta910@gmail.com>,
	steven.sistare@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" <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: Wed, 24 Jan 2018 19:47:36 -0500	[thread overview]
Message-ID: <59F98618-C49F-48A8-BCA1-A8F717888BAA@cs.rutgers.edu> (raw)
In-Reply-To: <ce7c1498-9f28-2eb0-67b7-ade9b04b8e2b@oracle.com>

[-- Attachment #1: Type: text/plain, Size: 2469 bytes --]


>
>>> 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.
>>
>
> Userpsace may want a region to be considered by khugepaged while opting
> out of hugepage allocation on first touch. Asking userspace memory
> allocators to have to track and reclaim unused parts of a THP allocated
> hugepage does not seems right, as the kernel can use simple userspace
> hints to avoid allocating extra memory in the first place.
>
> I agree that this patch is adding a subtle side-effect which may take
> some applications by surprise. However, I often see the opposite too:
> for many workloads, disabling THP is the first advise as this aggressive
> allocation of hugepages on first touch is unexpected and is too
> wasteful. For e.g.:
>
> 1) Disabling THP for TokuDB (Storage engine for MySQL, MariaDB)
> http://www.chriscalender.com/disabling-transparent-hugepages-for-tokudb/
>
> 2) Disable THP on MongoDB
> https://docs.mongodb.com/manual/tutorial/transparent-huge-pages/
>
> 3) Disable THP for Couchbase Server
> https://blog.couchbase.com/often-overlooked-linux-os-tweaks/
>
> 4) Redis
> http://antirez.com/news/84
>
>
>> If the memory is used really scarce then we have MADV_NOHUGEPAGE.
>>
>
> It's not really about memory scarcity but a more efficient use of it.
> Applications may want hugepage benefits without requiring any changes to
> app code which is what THP is supposed to provide, while still avoiding
> memory bloat.
>

I read these links and find that there are mainly two complains:
1. THP causes latency spikes, because direction compaction slows down THP allocation,
2. THP bloats memory footprint when jemalloc uses MADV_DONTNEED to return memory ranges smaller than
   THP size and fails because of THP.

The first complain is not related to this patch.

For second one, at least with recent kernels, MADV_DONTNEED splits THPs and returns the memory range you
specified in madvise(). Am I missing anything?


—
Best Regards,
Yan Zi

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 557 bytes --]

  reply	other threads:[~2018-01-25  0:47 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-18 23:33 Nitin Gupta
2018-01-19 12:49 ` Michal Hocko
2018-01-19 20:59   ` Nitin Gupta
2018-01-25  0:47     ` Zi Yan [this message]
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=59F98618-C49F-48A8-BCA1-A8F717888BAA@cs.rutgers.edu \
    --to=zi.yan@cs.rutgers.edu \
    --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=mhocko@kernel.org \
    --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