linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Cyrill Gorcunov <gorcunov@gmail.com>
To: David Rientjes <rientjes@google.com>
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: Wed, 6 May 2009 10:44:10 +0400	[thread overview]
Message-ID: <20090506064410.GB4865@lenovo> (raw)
In-Reply-To: <alpine.DEB.2.00.0905052334391.9824@chino.kir.corp.google.com>

[David Rientjes - Tue, May 05, 2009 at 11:36:38PM -0700]
| 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.
| 

ok, then we could just drop it.

	-- Cyrill

--
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>

      reply	other threads:[~2009-05-06  6:43 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-06  6:19 [PATCH -mmotm] mm: init_per_zone_pages_min - get rid of sqrt call on small machines Cyrill Gorcunov
2009-05-06  6:36 ` David Rientjes
2009-05-06  6:44   ` Cyrill Gorcunov [this message]

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=20090506064410.GB4865@lenovo \
    --to=gorcunov@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).