From: David Rientjes <rientjes@google.com>
To: Cyrill Gorcunov <gorcunov@openvz.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
LMMML <linux-mm@kvack.org>, LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH -mmotm] mm: init_per_zone_pages_min - get rid of sqrt call on small machines
Date: Tue, 5 May 2009 23:36:38 -0700 (PDT) [thread overview]
Message-ID: <alpine.DEB.2.00.0905052334391.9824@chino.kir.corp.google.com> (raw)
In-Reply-To: <20090506061953.GA16057@lenovo>
On Wed, 6 May 2009, Cyrill Gorcunov wrote:
> Index: linux-2.6.git/mm/page_alloc.c
> =====================================================================
> --- linux-2.6.git.orig/mm/page_alloc.c
> +++ linux-2.6.git/mm/page_alloc.c
> @@ -4610,11 +4610,15 @@ static int __init init_per_zone_pages_mi
>
> lowmem_kbytes = nr_free_buffer_pages() * (PAGE_SIZE >> 10);
>
> - min_free_kbytes = int_sqrt(lowmem_kbytes * 16);
> - if (min_free_kbytes < 128)
> + /* for small values we may eliminate sqrt operation completely */
> + if (lowmem_kbytes < 1024)
> min_free_kbytes = 128;
> - if (min_free_kbytes > 65536)
> - min_free_kbytes = 65536;
> + else {
> + min_free_kbytes = int_sqrt(lowmem_kbytes * 16);
> + if (min_free_kbytes > 65536)
> + min_free_kbytes = 65536;
> + }
> +
> setup_per_zone_pages_min();
> setup_per_zone_lowmem_reserve();
> setup_per_zone_inactive_ratio();
For a function that's called once, this just isn't worth it. int_sqrt()
isn't expensive enough to warrant the assault on the readability of the
code.
--
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/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2009-05-06 6:36 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-06 6:19 Cyrill Gorcunov
2009-05-06 6:36 ` David Rientjes [this message]
2009-05-06 6:44 ` Cyrill Gorcunov
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=alpine.DEB.2.00.0905052334391.9824@chino.kir.corp.google.com \
--to=rientjes@google.com \
--cc=akpm@linux-foundation.org \
--cc=gorcunov@openvz.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.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