From: Mel Gorman <mgorman@techsingularity.net>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Vlastimil Babka <vbabka@suse.cz>, Rik van Riel <riel@redhat.com>,
Johannes Weiner <hannes@cmpxchg.org>,
Andrea Arcangeli <aarcange@redhat.com>,
Linux-MM <linux-mm@kvack.org>,
LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH] mm: thp: Set THP defrag by default to madvise and add a stall-free defrag option -fix
Date: Tue, 1 Mar 2016 13:44:28 +0000 [thread overview]
Message-ID: <20160301134428.GH2854@techsingularity.net> (raw)
In-Reply-To: <56D59AC7.1020104@suse.cz>
The following is a fix to the patch
mm-thp-set-thp-defrag-by-default-to-madvise-and-add-a-stall-free-defrag-option.patch
based on feedback from Vlastimil Babka. It removes an unnecessary VM_BUG_ON for tidyness,
clarifies documentation and adds a check forbidding someone writing "defer" to the enable
knob for transparent huge pages. The ack from Vlastimil applies for the
original patch plus this fix combined.
Signed-off-by: Mel Gorman <mgorman@techsingularity.net>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
---
Documentation/vm/transhuge.txt | 2 +-
mm/huge_memory.c | 7 ++++---
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/Documentation/vm/transhuge.txt b/Documentation/vm/transhuge.txt
index a19b173cbc57..1943fe051a36 100644
--- a/Documentation/vm/transhuge.txt
+++ b/Documentation/vm/transhuge.txt
@@ -129,7 +129,7 @@ available in the near future. It's the responsibility of khugepaged
to then install the THP pages later.
"madvise" will enter direct reclaim like "always" but only for regions
-that are have used madvise(). This is the default behaviour.
+that are have used madvise(MADV_HUGEPAGE). This is the default behaviour.
"never" should be self-explanatory.
diff --git a/mm/huge_memory.c b/mm/huge_memory.c
index 206f35f06d83..9161b3a83720 100644
--- a/mm/huge_memory.c
+++ b/mm/huge_memory.c
@@ -246,6 +246,8 @@ static ssize_t triple_flag_store(struct kobject *kobj,
{
if (!memcmp("defer", buf,
min(sizeof("defer")-1, count))) {
+ if (enabled == deferred)
+ return -EINVAL;
clear_bit(enabled, &transparent_hugepage_flags);
clear_bit(req_madv, &transparent_hugepage_flags);
set_bit(deferred, &transparent_hugepage_flags);
@@ -273,10 +275,9 @@ static ssize_t triple_flag_store(struct kobject *kobj,
static ssize_t enabled_show(struct kobject *kobj,
struct kobj_attribute *attr, char *buf)
{
- if (test_bit(TRANSPARENT_HUGEPAGE_FLAG, &transparent_hugepage_flags)) {
- VM_BUG_ON(test_bit(TRANSPARENT_HUGEPAGE_REQ_MADV_FLAG, &transparent_hugepage_flags));
+ if (test_bit(TRANSPARENT_HUGEPAGE_FLAG, &transparent_hugepage_flags))
return sprintf(buf, "[always] madvise never\n");
- } else if (test_bit(TRANSPARENT_HUGEPAGE_REQ_MADV_FLAG, &transparent_hugepage_flags))
+ else if (test_bit(TRANSPARENT_HUGEPAGE_REQ_MADV_FLAG, &transparent_hugepage_flags))
return sprintf(buf, "always [madvise] never\n");
else
return sprintf(buf, "always madvise [never]\n");
--
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>
WARNING: multiple messages have this Message-ID (diff)
From: Mel Gorman <mgorman@techsingularity.net>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Vlastimil Babka <vbabka@suse.cz>, Rik van Riel <riel@redhat.com>,
Johannes Weiner <hannes@cmpxchg.org>,
Andrea Arcangeli <aarcange@redhat.com>,
Linux-MM <linux-mm@kvack.org>,
LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH] mm: thp: Set THP defrag by default to madvise and add a stall-free defrag option -fix
Date: Tue, 1 Mar 2016 13:44:28 +0000 [thread overview]
Message-ID: <20160301134428.GH2854@techsingularity.net> (raw)
In-Reply-To: <56D59AC7.1020104@suse.cz>
The following is a fix to the patch
mm-thp-set-thp-defrag-by-default-to-madvise-and-add-a-stall-free-defrag-option.patch
based on feedback from Vlastimil Babka. It removes an unnecessary VM_BUG_ON for tidyness,
clarifies documentation and adds a check forbidding someone writing "defer" to the enable
knob for transparent huge pages. The ack from Vlastimil applies for the
original patch plus this fix combined.
Signed-off-by: Mel Gorman <mgorman@techsingularity.net>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
---
Documentation/vm/transhuge.txt | 2 +-
mm/huge_memory.c | 7 ++++---
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/Documentation/vm/transhuge.txt b/Documentation/vm/transhuge.txt
index a19b173cbc57..1943fe051a36 100644
--- a/Documentation/vm/transhuge.txt
+++ b/Documentation/vm/transhuge.txt
@@ -129,7 +129,7 @@ available in the near future. It's the responsibility of khugepaged
to then install the THP pages later.
"madvise" will enter direct reclaim like "always" but only for regions
-that are have used madvise(). This is the default behaviour.
+that are have used madvise(MADV_HUGEPAGE). This is the default behaviour.
"never" should be self-explanatory.
diff --git a/mm/huge_memory.c b/mm/huge_memory.c
index 206f35f06d83..9161b3a83720 100644
--- a/mm/huge_memory.c
+++ b/mm/huge_memory.c
@@ -246,6 +246,8 @@ static ssize_t triple_flag_store(struct kobject *kobj,
{
if (!memcmp("defer", buf,
min(sizeof("defer")-1, count))) {
+ if (enabled == deferred)
+ return -EINVAL;
clear_bit(enabled, &transparent_hugepage_flags);
clear_bit(req_madv, &transparent_hugepage_flags);
set_bit(deferred, &transparent_hugepage_flags);
@@ -273,10 +275,9 @@ static ssize_t triple_flag_store(struct kobject *kobj,
static ssize_t enabled_show(struct kobject *kobj,
struct kobj_attribute *attr, char *buf)
{
- if (test_bit(TRANSPARENT_HUGEPAGE_FLAG, &transparent_hugepage_flags)) {
- VM_BUG_ON(test_bit(TRANSPARENT_HUGEPAGE_REQ_MADV_FLAG, &transparent_hugepage_flags));
+ if (test_bit(TRANSPARENT_HUGEPAGE_FLAG, &transparent_hugepage_flags))
return sprintf(buf, "[always] madvise never\n");
- } else if (test_bit(TRANSPARENT_HUGEPAGE_REQ_MADV_FLAG, &transparent_hugepage_flags))
+ else if (test_bit(TRANSPARENT_HUGEPAGE_REQ_MADV_FLAG, &transparent_hugepage_flags))
return sprintf(buf, "always [madvise] never\n");
else
return sprintf(buf, "always madvise [never]\n");
next prev parent reply other threads:[~2016-03-01 13:44 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-26 16:15 [PATCH 1/1] mm: thp: Set THP defrag by default to madvise and add a stall-free defrag option Mel Gorman
2016-02-26 16:15 ` Mel Gorman
2016-03-01 12:42 ` Vlastimil Babka
2016-03-01 12:42 ` Vlastimil Babka
2016-03-01 13:31 ` Mel Gorman
2016-03-01 13:31 ` Mel Gorman
2016-03-01 13:36 ` Vlastimil Babka
2016-03-01 13:36 ` Vlastimil Babka
2016-03-01 13:44 ` Mel Gorman [this message]
2016-03-01 13:44 ` [PATCH] mm: thp: Set THP defrag by default to madvise and add a stall-free defrag option -fix Mel Gorman
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=20160301134428.GH2854@techsingularity.net \
--to=mgorman@techsingularity.net \
--cc=aarcange@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=hannes@cmpxchg.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=riel@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.