From: Cong Wang <amwang@redhat.com>
To: Andrea Arcangeli <aarcange@redhat.com>
Cc: Vivek Goyal <vgoyal@redhat.com>, Rik van Riel <riel@redhat.com>,
Mel Gorman <mgorman@suse.de>,
linux-kernel@vger.kernel.org, akpm@linux-foundation.org,
Johannes Weiner <jweiner@redhat.com>,
KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
linux-mm@kvack.org
Subject: Re: [PATCH 1/3] mm: completely disable THP by transparent_hugepage=never
Date: Tue, 21 Jun 2011 12:08:14 +0800 [thread overview]
Message-ID: <4E00192E.70901@redhat.com> (raw)
In-Reply-To: <20110620192117.GG20843@redhat.com>
于 2011年06月21日 03:21, Andrea Arcangeli 写道:
> On Mon, Jun 20, 2011 at 02:25:58PM -0400, Vivek Goyal wrote:
>> So I see some opprotunity there to save memory. But this 10kB
>> definitely sounds trivial amount to me.
>
> Agree with you and Rik. Also I already avoided the big memory waste
> (that for example isn't avoided in the ksmd and could be optimized
> away without decreasing flexibility of KSM, and ksmd surely runs on
> the kdump kernel too...) that is to make khugepaged exit and release
> kernel stack when enabled=never (either done by sysfs or at boot with
> transparent_hugepage=never) and all other structs associated with a
> (temporarily) useless kernel thread.
I agree to disable ksm in kdump kernel, thanks for pointing this out!
I will look into later, and probably send a patch for this too.
>
> The khugepaged_slab_init and mm_slot_hash_init() maybe could be
> deferred to when khugepaged starts, and be released when it shutdown
> but it makes it more tricky/racey. If you really want to optimize
> that, without preventing to ever enable THP again despite all .text
> was compiled in and ready to run. You will likely save more if you
> make ksmd exit when run=0 (which btw is a much more common config than
> enabled=never with THP). And slots hashes are allocated by ksm too so
> you could optimize those too if you want and allocate them only by the
> time ksmd starts.
The thing is that we can save ~10K by adding 3 lines of code as this
patch showed, where else in kernel can you save 10K by 3 lines of code?
(except some kfree() cases, of course) So, again, why not have it? ;)
>
> As long as it'd still possible to enable the feature again as it is
> possible now without noticing an altered behavior from userland, I'm
> not entirely against optimizing for saving ~8k of ram even if it
> increases complexity a bit (more kernel code will increase .text a bit
> though, hopefully not 8k more of .text ;).
Why do we _force_ the feature to be tunable even when user completely
don't want to disable it? Why not provide a way to let the user to decide
which is better for him?
When programming kernel, providing a mechanism rather than a policy is
what I always keep in mind, I don't know why you violate this rule here,
to be honest. :-/
Thanks.
WARNING: multiple messages have this Message-ID (diff)
From: Cong Wang <amwang@redhat.com>
To: Andrea Arcangeli <aarcange@redhat.com>
Cc: Vivek Goyal <vgoyal@redhat.com>, Rik van Riel <riel@redhat.com>,
Mel Gorman <mgorman@suse.de>,
linux-kernel@vger.kernel.org, akpm@linux-foundation.org,
Johannes Weiner <jweiner@redhat.com>,
KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
linux-mm@kvack.org
Subject: Re: [PATCH 1/3] mm: completely disable THP by transparent_hugepage=never
Date: Tue, 21 Jun 2011 12:08:14 +0800 [thread overview]
Message-ID: <4E00192E.70901@redhat.com> (raw)
In-Reply-To: <20110620192117.GG20843@redhat.com>
ao? 2011a1'06ae??21ae?JPY 03:21, Andrea Arcangeli a??e??:
> On Mon, Jun 20, 2011 at 02:25:58PM -0400, Vivek Goyal wrote:
>> So I see some opprotunity there to save memory. But this 10kB
>> definitely sounds trivial amount to me.
>
> Agree with you and Rik. Also I already avoided the big memory waste
> (that for example isn't avoided in the ksmd and could be optimized
> away without decreasing flexibility of KSM, and ksmd surely runs on
> the kdump kernel too...) that is to make khugepaged exit and release
> kernel stack when enabled=never (either done by sysfs or at boot with
> transparent_hugepage=never) and all other structs associated with a
> (temporarily) useless kernel thread.
I agree to disable ksm in kdump kernel, thanks for pointing this out!
I will look into later, and probably send a patch for this too.
>
> The khugepaged_slab_init and mm_slot_hash_init() maybe could be
> deferred to when khugepaged starts, and be released when it shutdown
> but it makes it more tricky/racey. If you really want to optimize
> that, without preventing to ever enable THP again despite all .text
> was compiled in and ready to run. You will likely save more if you
> make ksmd exit when run=0 (which btw is a much more common config than
> enabled=never with THP). And slots hashes are allocated by ksm too so
> you could optimize those too if you want and allocate them only by the
> time ksmd starts.
The thing is that we can save ~10K by adding 3 lines of code as this
patch showed, where else in kernel can you save 10K by 3 lines of code?
(except some kfree() cases, of course) So, again, why not have it? ;)
>
> As long as it'd still possible to enable the feature again as it is
> possible now without noticing an altered behavior from userland, I'm
> not entirely against optimizing for saving ~8k of ram even if it
> increases complexity a bit (more kernel code will increase .text a bit
> though, hopefully not 8k more of .text ;).
Why do we _force_ the feature to be tunable even when user completely
don't want to disable it? Why not provide a way to let the user to decide
which is better for him?
When programming kernel, providing a mechanism rather than a policy is
what I always keep in mind, I don't know why you violate this rule here,
to be honest. :-/
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>
next prev parent reply other threads:[~2011-06-21 4:08 UTC|newest]
Thread overview: 83+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-20 16:34 [PATCH 1/3] mm: completely disable THP by transparent_hugepage=never Amerigo Wang
2011-06-20 16:34 ` Amerigo Wang
2011-06-20 16:34 ` [PATCH 2/3] mm: make the threshold of enabling THP configurable Amerigo Wang
2011-06-20 16:34 ` Amerigo Wang
2011-06-20 16:59 ` Dave Hansen
2011-06-20 16:59 ` Dave Hansen
2011-06-20 17:23 ` Cong Wang
2011-06-20 17:23 ` Cong Wang
2011-06-20 16:59 ` Mel Gorman
2011-06-20 16:59 ` Mel Gorman
2011-06-20 17:16 ` Cong Wang
2011-06-20 17:16 ` Cong Wang
2011-06-21 9:36 ` Mel Gorman
2011-06-21 9:36 ` Mel Gorman
2011-06-22 2:41 ` Cong Wang
2011-06-22 2:41 ` Cong Wang
2011-06-22 9:16 ` Mel Gorman
2011-06-22 9:16 ` Mel Gorman
2011-06-22 10:46 ` Cong Wang
2011-06-22 10:46 ` Cong Wang
2011-06-22 11:15 ` Mel Gorman
2011-06-22 11:15 ` Mel Gorman
2011-06-22 12:34 ` Cong Wang
2011-06-22 12:34 ` Cong Wang
2011-06-20 16:34 ` [PATCH 3/3] mm: print information when THP is disabled automatically Amerigo Wang
2011-06-20 16:34 ` Amerigo Wang
2011-06-20 16:54 ` Andrea Arcangeli
2011-06-20 16:54 ` Andrea Arcangeli
2011-06-20 17:25 ` Cong Wang
2011-06-20 17:25 ` Cong Wang
2011-06-20 17:01 ` Mel Gorman
2011-06-20 17:01 ` Mel Gorman
2011-06-20 17:26 ` Cong Wang
2011-06-20 17:26 ` Cong Wang
2011-06-20 19:37 ` Andrea Arcangeli
2011-06-20 19:37 ` Andrea Arcangeli
2011-06-21 9:40 ` Mel Gorman
2011-06-21 9:40 ` Mel Gorman
2011-06-20 16:50 ` [PATCH 1/3] mm: completely disable THP by transparent_hugepage=never Andrea Arcangeli
2011-06-20 16:50 ` Andrea Arcangeli
2011-06-20 16:55 ` Rik van Riel
2011-06-20 16:55 ` Rik van Riel
2011-06-20 17:01 ` Cong Wang
2011-06-20 17:01 ` Cong Wang
2011-06-20 19:43 ` Andrea Arcangeli
2011-06-20 19:43 ` Andrea Arcangeli
2011-06-21 3:15 ` Cong Wang
2011-06-21 3:15 ` Cong Wang
2011-06-20 16:58 ` Mel Gorman
2011-06-20 16:58 ` Mel Gorman
2011-06-20 17:07 ` Cong Wang
2011-06-20 17:07 ` Cong Wang
2011-06-20 17:10 ` Rik van Riel
2011-06-20 17:10 ` Rik van Riel
2011-06-20 17:19 ` Cong Wang
2011-06-20 17:19 ` Cong Wang
2011-06-20 17:28 ` Rik van Riel
2011-06-20 17:28 ` Rik van Riel
2011-06-20 17:34 ` Cong Wang
2011-06-20 17:34 ` Cong Wang
2011-06-20 17:50 ` Rik van Riel
2011-06-20 17:50 ` Rik van Riel
2011-06-20 18:25 ` Vivek Goyal
2011-06-20 18:25 ` Vivek Goyal
2011-06-20 19:21 ` Andrea Arcangeli
2011-06-20 19:21 ` Andrea Arcangeli
2011-06-21 4:08 ` Cong Wang [this message]
2011-06-21 4:08 ` Cong Wang
2011-06-21 14:43 ` Andrea Arcangeli
2011-06-21 14:43 ` Andrea Arcangeli
2011-06-22 2:56 ` Cong Wang
2011-06-22 2:56 ` Cong Wang
2011-06-22 14:22 ` Andrea Arcangeli
2011-06-22 14:22 ` Andrea Arcangeli
2011-06-21 20:01 ` Rik van Riel
2011-06-21 20:01 ` Rik van Riel
2011-06-21 3:28 ` Cong Wang
2011-06-21 3:28 ` Cong Wang
2011-06-20 17:58 ` Eric B Munson
2011-06-21 3:36 ` Cong Wang
2011-06-21 3:36 ` Cong Wang
2011-06-20 17:59 ` Vivek Goyal
2011-06-20 17:59 ` Vivek Goyal
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=4E00192E.70901@redhat.com \
--to=amwang@redhat.com \
--cc=aarcange@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=jweiner@redhat.com \
--cc=kamezawa.hiroyu@jp.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mgorman@suse.de \
--cc=riel@redhat.com \
--cc=vgoyal@redhat.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.