All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gerald Schaefer <gerald.schaefer@gmx.net>
To: linux-kernel@vger.kernel.org
Cc: mpm@selenic.com
Subject: Re: [PATCH] shrink hash sizes on small machines, take 2
Date: Tue, 18 May 2004 14:32:24 +0200	[thread overview]
Message-ID: <200405181432.24895.gerald.schaefer@gmx.net> (raw)

On Sat, Apr 10, 2004, Matt Mackall wrote:
> Base hash sizes on available memory rather than total memory. An
> additional 50% above current used memory is considered reserved for
> the purposes of hash sizing to compensate for the hashes themselves
> and the remainder of kernel and userspace initialization.
> 
> Index: tiny/fs/dcache.c
> ===================================================================
> --- tiny.orig/fs/dcache.c	2004-03-25 13:36:09.000000000 -0600
> +++ tiny/fs/dcache.c	2004-04-10 18:14:42.000000000 -0500
> @@ -28,6 +28,7 @@
>  #include <asm/uaccess.h>
>  #include <linux/security.h>
>  #include <linux/seqlock.h>
> +#include <linux/swap.h>
>  
>  #define DCACHE_PARANOIA 1
>  /* #define DCACHE_DEBUG 1 */
> @@ -1619,13 +1620,21 @@
> 
>  void __init vfs_caches_init(unsigned long mempages)
>  {
> -	names_cachep = kmem_cache_create("names_cache", 
> -			PATH_MAX, 0, 
> +	unsigned long reserve;
> +
> +	/* Base hash sizes on available memory, with a reserve equal to
> +           150% of current kernel size */
> +
> +	reserve = (mempages - nr_free_pages()) * 3/2;
> +	mempages -= reserve;

This calculation doesn't sound right. The value of mempages is set to
num_physpages from the calling function start_kernel(), which also
includes pages from a potential "mem=" kernel parameter (which we use
for reserving memory to load DCSS segments on z/VM).

Whenever the amount of reserved pages goes above some limit (for whatever
reason, not only with "mem="), this calculation results in a negative value
for mempages, respectively a very large value due to "unsigned long".

I am not on the mailing list, so please put me on cc if you answer.

--
Gerald

             reply	other threads:[~2004-05-18 12:32 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-05-18 12:32 Gerald Schaefer [this message]
     [not found] ` <20040518174210.GD28735@waste.org>
2004-05-19 17:40   ` [PATCH] shrink hash sizes on small machines, take 2 Gerald Schaefer
  -- strict thread matches above, loose matches on Subject: below --
2004-04-10 23:27 Matt Mackall
2004-04-15 15:16 ` Marcelo Tosatti

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=200405181432.24895.gerald.schaefer@gmx.net \
    --to=gerald.schaefer@gmx.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mpm@selenic.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.