All of lore.kernel.org
 help / color / mirror / Atom feed
From: Cong Wang <amwang@redhat.com>
To: David Rientjes <rientjes@google.com>
Cc: linux-kernel@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>,
	dave@linux.vnet.ibm.com, Andrea Arcangeli <aarcange@redhat.com>,
	Mel Gorman <mel@csn.ul.ie>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	Rik van Riel <riel@redhat.com>,
	Johannes Weiner <hannes@cmpxchg.org>,
	KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
	linux-mm@kvack.org
Subject: Re: [PATCH v2 2/4] mm: make the threshold of enabling THP configurable
Date: Wed, 22 Jun 2011 19:07:25 +0800	[thread overview]
Message-ID: <4E01CCED.5050609@redhat.com> (raw)
In-Reply-To: <alpine.DEB.2.00.1106212325400.14693@chino.kir.corp.google.com>

于 2011年06月22日 14:32, David Rientjes 写道:
> On Wed, 22 Jun 2011, Cong Wang wrote:
>
>>> Either way, this patch isn't needed since it has no benefit over doing it
>>> through an init script.
>>
>> If you were right, CONFIG_TRANSPARENT_HUGEPAGE_ALWAYS is not needed,
>> you can do it through an init script.
>>
>
> They are really two different things: config options like
> CONFIG_TRANSPARENT_HUGEPAGE_ALWAYS and CONFIG_SLUB_DEBUG_ON are shortcuts
> for command line options when you want the _default_ behavior to be
> specified.  They could easily be done on the command line just as they can
> be done in the config.  They typically have far reaching consequences
> depending on whether they are enabled or disabled and warrant the entry in
> the config file.
>
> This patch, however, is not making the heuristic any easier to work with;
> in fact, if the default were ever changed or the value is changed on your
> kernel, then certain kernels will have THP enabled by default and others
> will not.  That's why I suggested an override command line option like
> transparent_hugepage=force to ignore any disabling heursitics either
> present or future.

Actually, if we move this out of kernel, to user-space, everything
you worried will be solved by just changing the user-space code.
Just add the following pseudo code into your init script,

if [ $total_memory -lt 512 ]
then
	echo never > /sys/kernel/mm/transparent_hugepage/enabled
fi

BTW, "=force" makes people confused with "=always", like "=never"
actually means "=disabled".

>
>> If you were right, the 512M limit is not needed neither, you have
>> transparent_hugepage=never boot parameter and do the check of
>> 512M later in an init script. (Actually, moving the 512M check to
>> user-space is really more sane to me.)
>>
>
> It's quite obvious that the default behavior intended by the author is
> that it is defaulted off for systems with less than 512M of memory.
> Obfuscating that probably isn't a very good idea, but I'm always in favor
> of command lines that allow users to override settings when they really do
> know better.

The better way to express this is to add one line in Kconfig help said
"Please set CONFIG_THP_NEVER=y when you have less than 512M memory",
rather than enforcing a decision in code.

 From either aspect, I don't think the current 512M check code in kernel
is a good thing.

Thanks.

WARNING: multiple messages have this Message-ID (diff)
From: Cong Wang <amwang@redhat.com>
To: David Rientjes <rientjes@google.com>
Cc: linux-kernel@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>,
	dave@linux.vnet.ibm.com, Andrea Arcangeli <aarcange@redhat.com>,
	Mel Gorman <mel@csn.ul.ie>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	Rik van Riel <riel@redhat.com>,
	Johannes Weiner <hannes@cmpxchg.org>,
	KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
	linux-mm@kvack.org
Subject: Re: [PATCH v2 2/4] mm: make the threshold of enabling THP configurable
Date: Wed, 22 Jun 2011 19:07:25 +0800	[thread overview]
Message-ID: <4E01CCED.5050609@redhat.com> (raw)
In-Reply-To: <alpine.DEB.2.00.1106212325400.14693@chino.kir.corp.google.com>

ao? 2011a1'06ae??22ae?JPY 14:32, David Rientjes a??e??:
> On Wed, 22 Jun 2011, Cong Wang wrote:
>
>>> Either way, this patch isn't needed since it has no benefit over doing it
>>> through an init script.
>>
>> If you were right, CONFIG_TRANSPARENT_HUGEPAGE_ALWAYS is not needed,
>> you can do it through an init script.
>>
>
> They are really two different things: config options like
> CONFIG_TRANSPARENT_HUGEPAGE_ALWAYS and CONFIG_SLUB_DEBUG_ON are shortcuts
> for command line options when you want the _default_ behavior to be
> specified.  They could easily be done on the command line just as they can
> be done in the config.  They typically have far reaching consequences
> depending on whether they are enabled or disabled and warrant the entry in
> the config file.
>
> This patch, however, is not making the heuristic any easier to work with;
> in fact, if the default were ever changed or the value is changed on your
> kernel, then certain kernels will have THP enabled by default and others
> will not.  That's why I suggested an override command line option like
> transparent_hugepage=force to ignore any disabling heursitics either
> present or future.

Actually, if we move this out of kernel, to user-space, everything
you worried will be solved by just changing the user-space code.
Just add the following pseudo code into your init script,

if [ $total_memory -lt 512 ]
then
	echo never > /sys/kernel/mm/transparent_hugepage/enabled
fi

BTW, "=force" makes people confused with "=always", like "=never"
actually means "=disabled".

>
>> If you were right, the 512M limit is not needed neither, you have
>> transparent_hugepage=never boot parameter and do the check of
>> 512M later in an init script. (Actually, moving the 512M check to
>> user-space is really more sane to me.)
>>
>
> It's quite obvious that the default behavior intended by the author is
> that it is defaulted off for systems with less than 512M of memory.
> Obfuscating that probably isn't a very good idea, but I'm always in favor
> of command lines that allow users to override settings when they really do
> know better.

The better way to express this is to add one line in Kconfig help said
"Please set CONFIG_THP_NEVER=y when you have less than 512M memory",
rather than enforcing a decision in code.

 From either aspect, I don't think the current 512M check code in kernel
is a good thing.

Thanks.

--
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/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2011-06-22 11:08 UTC|newest]

Thread overview: 56+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-21  8:10 [PATCH v2 1/4] mm: completely disable THP by transparent_hugepage=0 Amerigo Wang
2011-06-21  8:10 ` Amerigo Wang
2011-06-21  8:10 ` [PATCH v2 2/4] mm: make the threshold of enabling THP configurable Amerigo Wang
2011-06-21  8:10   ` Amerigo Wang
2011-06-21 14:44   ` Dave Hansen
2011-06-21 14:44     ` Dave Hansen
2011-06-21 20:17     ` Dave Hansen
2011-06-21 20:17       ` Dave Hansen
2011-06-22  1:23   ` David Rientjes
2011-06-22  1:23     ` David Rientjes
2011-06-22  3:06     ` Cong Wang
2011-06-22  3:06       ` Cong Wang
2011-06-22  3:29       ` David Rientjes
2011-06-22  3:29         ` David Rientjes
2011-06-22  5:40         ` Cong Wang
2011-06-22  5:40           ` Cong Wang
2011-06-22  6:32           ` David Rientjes
2011-06-22  6:32             ` David Rientjes
2011-06-22 11:07             ` Cong Wang [this message]
2011-06-22 11:07               ` Cong Wang
2011-06-22 14:40               ` Andrea Arcangeli
2011-06-22 14:40                 ` Andrea Arcangeli
2011-06-23  6:51                 ` Cong Wang
2011-06-23  6:51                   ` Cong Wang
2011-06-21  8:10 ` [PATCH 3/4] mm: improve THP printk messages Amerigo Wang
2011-06-21  8:10   ` Amerigo Wang
2011-06-22  1:23   ` David Rientjes
2011-06-22  1:23     ` David Rientjes
2011-06-22  3:04     ` Cong Wang
2011-06-22  3:04       ` Cong Wang
2011-06-21  8:10 ` [PATCH 4/4] mm: introduce no_ksm to disable totally KSM Amerigo Wang
2011-06-21  8:10   ` Amerigo Wang
2011-06-21 13:32   ` Andrea Arcangeli
2011-06-21 13:32     ` Andrea Arcangeli
2011-06-22  3:13     ` Cong Wang
2011-06-22  3:13       ` Cong Wang
2011-06-21 11:52 ` [PATCH v2 1/4] mm: completely disable THP by transparent_hugepage=0 Michal Hocko
2011-06-21 11:52   ` Michal Hocko
2011-06-21 11:58   ` Michal Hocko
2011-06-21 11:58     ` Michal Hocko
2011-06-21 13:30 ` Andrea Arcangeli
2011-06-21 13:30   ` Andrea Arcangeli
2011-06-22  3:11   ` Cong Wang
2011-06-22  3:11     ` Cong Wang
2011-06-22  1:16 ` David Rientjes
2011-06-22  1:16   ` David Rientjes
2011-06-22  3:08   ` Cong Wang
2011-06-22  3:08     ` Cong Wang
2011-06-22  3:24     ` David Rientjes
2011-06-22  3:24       ` David Rientjes
2011-06-22  5:45       ` Cong Wang
2011-06-22  5:45         ` Cong Wang
2011-06-22  6:23         ` David Rientjes
2011-06-22  6:23           ` David Rientjes
2011-06-22 11:08           ` Cong Wang
2011-06-22 11:08             ` Cong Wang

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=4E01CCED.5050609@redhat.com \
    --to=amwang@redhat.com \
    --cc=aarcange@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=benh@kernel.crashing.org \
    --cc=dave@linux.vnet.ibm.com \
    --cc=hannes@cmpxchg.org \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mel@csn.ul.ie \
    --cc=riel@redhat.com \
    --cc=rientjes@google.com \
    /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.