From: Greg Ungerer <gerg@snapgear.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: David Howells <dhowells@redhat.com>,
torvalds@linux-foundation.org, npiggin@suse.de,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/3] NOMMU: Make the initial mmap allocation excess behaviour Kconfig configurable
Date: Wed, 06 May 2009 10:09:01 +1000 [thread overview]
Message-ID: <4A00D51D.4080707@snapgear.com> (raw)
In-Reply-To: <20090505151520.070c84c1.akpm@linux-foundation.org>
Andrew Morton wrote:
> On Tue, 05 May 2009 22:26:48 +0100
> David Howells <dhowells@redhat.com> wrote:
>
>> NOMMU mmap() has an option controlled by a sysctl variable that determines
>> whether the allocations made by do_mmap_private() should have the excess space
>> trimmed off and returned to the allocator. Make the initial setting of this
>> variable a Kconfig configuration option.
>>
>> The reason there can be excess space is that the allocator only allocates in
>> power-of-2 size chunks, but mmap()'s can be made in sizes that aren't a power
>> of 2.
>>
>> There are two alternatives:
>>
>> (1) Keep the excess as dead space. The dead space then remains unused for the
>> lifetime of the mapping. Mappings of shared objects such as libc, ld.so
>> or busybox's text segment may retain their dead space forever.
>>
>> (2) Return the excess to the allocator. This means that the dead space is
>> limited to less than a page per mapping, but it means that for a transient
>> process, there's more chance of fragmentation as the excess space may be
>> reused fairly quickly.
>>
>> During the boot process, a lot of transient processes are created, and this can
>> cause a lot of fragmentation as the pagecache and various slabs grow greatly
>> during this time.
>>
>> By turning off the trimming of excess space during boot and disabling batching
>> of frees, Coldfire can manage to boot.
To put that in perspective better. Its not that all ColdFire platforms
don't boot. It depends very much on what you try to run from user space.
Typical small setups (which realistically is most ColdFire systems)
just don't try to run that much. As with anything embedded there is a
great variance on what people try to do...
Regards
Greg
>> A better way of doing things might be to have /sbin/init turn this option off.
>> By that point libc, ld.so and init - which are all long-duration processes -
>> have all been loaded and trimmed.
>>
>
> Nasty problem.
>
>> --- a/mm/nommu.c
>> +++ b/mm/nommu.c
>> @@ -66,7 +66,7 @@ struct percpu_counter vm_committed_as;
>> int sysctl_overcommit_memory = OVERCOMMIT_GUESS; /* heuristic overcommit */
>> int sysctl_overcommit_ratio = 50; /* default is 50% */
>> int sysctl_max_map_count = DEFAULT_MAX_MAP_COUNT;
>> -int sysctl_nr_trim_pages = 1; /* page trimming behaviour */
>> +int sysctl_nr_trim_pages = CONFIG_NOMMU_INITIAL_TRIM_EXCESS;
>> int heap_stack_gap = 0;
>>
>
> But there's a risk of -ENOMEM regression on other system here?
>
> It's unlikely to be a huge problem for real-world embedded developers,
> as long as they know about this change. And because you set the
> Kconfig default to "no change" then I guess they'll be none the wiser.
>
> I think that patches 2 and 3 (and #1 unless I reorder and redo things)
> are 2.6.30 material. Agree?
>
>
--
------------------------------------------------------------------------
Greg Ungerer -- Principal Engineer EMAIL: gerg@snapgear.com
SnapGear Group, McAfee PHONE: +61 7 3435 2888
825 Stanley St, FAX: +61 7 3891 3630
Woolloongabba, QLD, 4102, Australia WEB: http://www.SnapGear.com
next prev parent reply other threads:[~2009-05-06 0:09 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-05 21:26 [PATCH 1/3] Use roundown_pow_of_two() in zone_batchsize() David Howells
2009-05-05 21:26 ` [PATCH 2/3] NOMMU: Clamp zone_batchsize() to 0 under NOMMU conditions David Howells
2009-05-05 21:26 ` [PATCH 3/3] NOMMU: Make the initial mmap allocation excess behaviour Kconfig configurable David Howells
2009-05-05 22:15 ` Andrew Morton
2009-05-06 0:09 ` Greg Ungerer [this message]
2009-05-06 11:42 ` David Howells
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=4A00D51D.4080707@snapgear.com \
--to=gerg@snapgear.com \
--cc=akpm@linux-foundation.org \
--cc=dhowells@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=npiggin@suse.de \
--cc=torvalds@linux-foundation.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox