From: Michal Hocko <mhocko@kernel.org>
To: Vlastimil Babka <vbabka@suse.cz>
Cc: Mel Gorman <mgorman@techsingularity.net>,
David Rientjes <rientjes@google.com>,
Andrew Morton <akpm@linux-foundation.org>,
Jonathan Corbet <corbet@lwn.net>,
"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [patch] mm, thp: add new background defrag option
Date: Thu, 5 Jan 2017 16:50:54 +0100 [thread overview]
Message-ID: <20170105155053.GW21618@dhcp22.suse.cz> (raw)
In-Reply-To: <fe83f15e-2d9f-e36c-3a89-ce1a2b39e3ca@suse.cz>
On Thu 05-01-17 14:58:47, Vlastimil Babka wrote:
[...]
> I'm not a fan of either name, so I've tried to implement my own
> suggestion. Turns out it was easier than expected, as there's no kernel
> boot option for "defer", just for "enabled", so that particular worry
> was unfounded.
>
> And personally I think that it's less confusing when one can enable defer
> and madvise together (and not any other combination), than having to dig
> up the difference between "defer" and "background".
>
> I have only tested the sysfs manipulation, not actual THP, but seems to me
> that alloc_hugepage_direct_gfpmask() already happens to process the flags
> in a way that it works as expected.
IMHO this looks indeed much simpler implementation wise, more consistent
from the semantic point of view and less confusing from the usage POV.
> diff --git a/mm/huge_memory.c b/mm/huge_memory.c
> index 10eedbf14421..cc5ae86169a8 100644
> --- a/mm/huge_memory.c
> +++ b/mm/huge_memory.c
> @@ -150,7 +150,16 @@ static ssize_t triple_flag_store(struct kobject *kobj,
> enum transparent_hugepage_flag deferred,
> enum transparent_hugepage_flag req_madv)
> {
> - if (!memcmp("defer", buf,
> + if (!memcmp("defer madvise", buf,
> + min(sizeof("defer madvise")-1, count))
> + || !memcmp("madvise defer", buf,
> + min(sizeof("madvise defer")-1, count))) {
> + if (enabled == deferred)
> + return -EINVAL;
> + clear_bit(enabled, &transparent_hugepage_flags);
> + set_bit(req_madv, &transparent_hugepage_flags);
> + set_bit(deferred, &transparent_hugepage_flags);
> + } else if (!memcmp("defer", buf,
> min(sizeof("defer")-1, count))) {
> if (enabled == deferred)
> return -EINVAL;
> @@ -251,9 +260,12 @@ static ssize_t defrag_show(struct kobject *kobj,
> {
> if (test_bit(TRANSPARENT_HUGEPAGE_DEFRAG_DIRECT_FLAG, &transparent_hugepage_flags))
> return sprintf(buf, "[always] defer madvise never\n");
> - if (test_bit(TRANSPARENT_HUGEPAGE_DEFRAG_KSWAPD_FLAG, &transparent_hugepage_flags))
> - return sprintf(buf, "always [defer] madvise never\n");
> - else if (test_bit(TRANSPARENT_HUGEPAGE_DEFRAG_REQ_MADV_FLAG, &transparent_hugepage_flags))
> + if (test_bit(TRANSPARENT_HUGEPAGE_DEFRAG_KSWAPD_FLAG, &transparent_hugepage_flags)) {
> + if (test_bit(TRANSPARENT_HUGEPAGE_DEFRAG_REQ_MADV_FLAG, &transparent_hugepage_flags))
> + return sprintf(buf, "always [defer] [madvise] never\n");
> + else
> + return sprintf(buf, "always [defer] madvise never\n");
> + } else if (test_bit(TRANSPARENT_HUGEPAGE_DEFRAG_REQ_MADV_FLAG, &transparent_hugepage_flags))
> return sprintf(buf, "always defer [madvise] never\n");
> else
> return sprintf(buf, "always defer madvise [never]\n");
--
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>
next prev parent reply other threads:[~2017-01-05 15:50 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-04 23:41 David Rientjes
2017-01-05 10:13 ` Mel Gorman
2017-01-05 10:33 ` Michal Hocko
2017-01-05 13:58 ` Vlastimil Babka
2017-01-05 15:50 ` Michal Hocko [this message]
2017-01-05 22:54 ` David Rientjes
2017-01-06 8:41 ` Vlastimil Babka
2017-01-06 14:01 ` Michal Hocko
2017-01-06 22:20 ` David Rientjes
2017-01-09 10:04 ` Vlastimil Babka
2017-01-09 12:06 ` Vlastimil Babka
2017-01-10 2:19 ` David Rientjes
2017-01-10 3:38 ` Hugh Dickins
2017-01-10 8:44 ` Vlastimil Babka
2017-01-10 23:52 ` David Rientjes
2017-01-10 13:01 ` Michal Hocko
2017-01-11 0:15 ` [patch v2] mm, thp: add new defer+madvise " David Rientjes
2017-01-11 7:35 ` Vlastimil Babka
2017-01-12 8:01 ` Michal Hocko
2017-01-11 8:56 ` Mel Gorman
2017-01-12 0:16 ` Andrew Morton
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=20170105155053.GW21618@dhcp22.suse.cz \
--to=mhocko@kernel.org \
--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=rientjes@google.com \
--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