From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753674AbcCANgP (ORCPT ); Tue, 1 Mar 2016 08:36:15 -0500 Received: from mx2.suse.de ([195.135.220.15]:43412 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752628AbcCANgO (ORCPT ); Tue, 1 Mar 2016 08:36:14 -0500 Subject: Re: [PATCH 1/1] mm: thp: Set THP defrag by default to madvise and add a stall-free defrag option To: Mel Gorman References: <1456503359-4910-1-git-send-email-mgorman@techsingularity.net> <56D58E1E.5090708@suse.cz> <20160301133102.GG2854@techsingularity.net> Cc: Andrew Morton , Rik van Riel , Johannes Weiner , Andrea Arcangeli , Linux-MM , LKML From: Vlastimil Babka Message-ID: <56D59AC7.1020104@suse.cz> Date: Tue, 1 Mar 2016 14:36:07 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: <20160301133102.GG2854@techsingularity.net> Content-Type: text/plain; charset=iso-8859-15; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 03/01/2016 02:31 PM, Mel Gorman wrote: > This? > > ---8<--- > 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. > > Signed-off-by: Mel Gorman For the whole patch+fix. Acked-by: Vlastimil Babka > --- > 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"); >