The patch titled Subject: mm: thp: Set THP defrag by default to madvise and add a stall-free defrag option -fix has been added to the -mm tree. Its filename is mm-thp-set-thp-defrag-by-default-to-madvise-and-add-a-stall-free-defrag-option-fix.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/mm-thp-set-thp-defrag-by-default-to-madvise-and-add-a-stall-free-defrag-option-fix.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/mm-thp-set-thp-defrag-by-default-to-madvise-and-add-a-stall-free-defrag-option-fix.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/SubmitChecklist when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Mel Gorman <mgorman@xxxxxxxxxxxxxxxxxxx> Subject: mm: thp: Set THP defrag by default to madvise and add a stall-free defrag option -fix 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@xxxxxxxxxxxxxxxxxxx> Acked-by: Rik van Riel <riel@xxxxxxxxxx> Acked-by: Johannes Weiner <hannes@xxxxxxxxxxx> Acked-by: Vlastimil Babka <vbabka@xxxxxxx> Cc: Andrea Arcangeli <aarcange@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- Documentation/vm/transhuge.txt | 2 +- mm/huge_memory.c | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff -puN Documentation/vm/transhuge.txt~mm-thp-set-thp-defrag-by-default-to-madvise-and-add-a-stall-free-defrag-option-fix Documentation/vm/transhuge.txt --- a/Documentation/vm/transhuge.txt~mm-thp-set-thp-defrag-by-default-to-madvise-and-add-a-stall-free-defrag-option-fix +++ a/Documentation/vm/transhuge.txt @@ -129,7 +129,7 @@ available in the near future. It's the r 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 -puN mm/huge_memory.c~mm-thp-set-thp-defrag-by-default-to-madvise-and-add-a-stall-free-defrag-option-fix mm/huge_memory.c --- a/mm/huge_memory.c~mm-thp-set-thp-defrag-by-default-to-madvise-and-add-a-stall-free-defrag-option-fix +++ a/mm/huge_memory.c @@ -279,6 +279,8 @@ static ssize_t triple_flag_store(struct { 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); @@ -306,10 +308,9 @@ static ssize_t triple_flag_store(struct 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"); _ Patches currently in -mm which might be from mgorman@xxxxxxxxxxxxxxxxxxx are mm-filemap-remove-redundant-code-in-do_read_cache_page.patch mm-filemap-avoid-unnecessary-calls-to-lock_page-when-waiting-for-io-to-complete-during-a-read.patch mm-thp-set-thp-defrag-by-default-to-madvise-and-add-a-stall-free-defrag-option.patch mm-thp-set-thp-defrag-by-default-to-madvise-and-add-a-stall-free-defrag-option-fix.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html