From: David Rientjes <rientjes@google.com>
To: Vlastimil Babka <vbabka@suse.cz>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Jonathan Corbet <corbet@lwn.net>,
"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
Mel Gorman <mgorman@techsingularity.net>,
linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [patch] mm, thp: always direct reclaim for MADV_HUGEPAGE even when deferred
Date: Wed, 4 Jan 2017 14:04:27 -0800 (PST) [thread overview]
Message-ID: <alpine.DEB.2.10.1701041353220.77987@chino.kir.corp.google.com> (raw)
In-Reply-To: <75bf7af0-76e8-2d8e-cb00-745fd06c42ef@suse.cz>
On Wed, 4 Jan 2017, Vlastimil Babka wrote:
> > Hmm, is there a significant benefit to setting "defer" rather than "never"
> > if you can rely on khugepaged to trigger compaction when it tries to
> > allocate. I suppose if there is nothing to collapse that this won't do
> > compaction, but is this not intended for users who always want to defer
> > when not immediately available?
>
> I guess two things
> - khugepaged is quite sleepy and will not respond to demand quickly, so
> it won't compact that much than kcompactd triggered by "defer"
That's configurable, so if a user sets defrag to never, they also have the
ability to make khugepaged more aggressive in the background to complement
that decision.
> I don't think the primary motivation for "defer" was to restrict
> MADV_HUGEPAGE apps, but rather to prevent latency to the majority of
> apps oblivious to THP when the default was "always". On the other hand,
> setting "madvise" would make performance needlessly worse in some
> scenarios, so "defer" is a compromise that tries to provide THP's but
> without the latency, and still much more timely than khugepaged.
>
It's disappointing we need to have an option that exists solely to
suppress a userspace MADV_HUGEPAGE and not actually fix the userspace to
not do the MADV_HUGEPAGE in the first place by making it configurable.
That is backwards compatible and doesn't require a new kernel version.
This never gets answered in the thread, however, and I offered to make the
very trivial patch to qemu to do that for the translation buffer but
nobody who uses qemu is even asking for this. It's baffling.
> >> So would something like this be possible?
> >>
> >>> echo "defer madvise" > /sys/kernel/mm/transparent_hugepage/defrag
> >>> cat /sys/kernel/mm/transparent_hugepage/defrag
> >> always [defer] [madvise] never
> >>
> >> I'm not sure about the analogous kernel boot option though, I guess
> >> those can't use spaces, so maybe comma-separated?
>
> No opinion on the above? I think it could be somewhat more elegant than
> a fifth-option that Mel said he would prefer, and deliver the same
> flexibility.
>
I think this would work, but I'm concerned about two things: (1) the
kernel command line format as you pointed out earlier, (2) allowing two
options to be combined but not other options (always + never), so it takes
even more explaining to do to say what you can actually formulate and
what the results of that combining is. The tristate, quadstate, and now
quint-state options for thp were never extendable, but now this appears to
be the most desired option. We can await the bug reports of users who say
their MADV_HUGEPAGE is a no-op, though, and tell them their admin needs to
switch away from "defer" if anybody actually ever uses that setting.
I think you, me, and Kirill are mostly on the same page with respect to
this, but I can't argue against hypothetical usecases and how we need to
wait years for "defer" to be available to see if any bug reports are
generated to make a decision in this area, so my final proposal in this
matter will be the reluctant fifth option and if it doesn't work I'll just
carry this for ourselves (we have no use for "defer" without this patch).
--
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>
prev parent reply other threads:[~2017-01-04 22:04 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-22 0:21 David Rientjes
2016-12-22 8:31 ` Kirill A. Shutemov
2016-12-22 10:00 ` Michal Hocko
2016-12-22 21:05 ` David Rientjes
2016-12-23 8:51 ` Michal Hocko
2016-12-23 10:01 ` David Rientjes
2016-12-23 11:18 ` Michal Hocko
2016-12-23 22:46 ` David Rientjes
2016-12-26 9:02 ` Michal Hocko
2016-12-27 0:53 ` David Rientjes
2016-12-27 2:32 ` Kirill A. Shutemov
2016-12-27 9:41 ` Michal Hocko
2016-12-27 21:36 ` David Rientjes
2016-12-28 8:48 ` Michal Hocko
2016-12-28 21:33 ` David Rientjes
2016-12-29 8:24 ` Michal Hocko
2016-12-30 12:36 ` Mel Gorman
2016-12-30 12:56 ` Michal Hocko
2016-12-30 14:08 ` Mel Gorman
2016-12-30 22:30 ` David Rientjes
2017-01-03 10:37 ` Mel Gorman
2017-01-03 21:57 ` David Rientjes
2017-01-04 10:12 ` Mel Gorman
2017-01-04 21:53 ` David Rientjes
2017-01-02 8:38 ` Vlastimil Babka
2017-01-03 22:44 ` David Rientjes
2017-01-04 8:32 ` Vlastimil Babka
2017-01-04 9:46 ` Michal Hocko
2017-01-04 22:04 ` David Rientjes [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=alpine.DEB.2.10.1701041353220.77987@chino.kir.corp.google.com \
--to=rientjes@google.com \
--cc=akpm@linux-foundation.org \
--cc=corbet@lwn.net \
--cc=kirill.shutemov@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mgorman@techsingularity.net \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox