All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anton Blanchard <anton@samba.org>
To: Nick Piggin <nickpiggin@yahoo.com.au>
Cc: Andrew Morton <akpm@osdl.org>,
	linux-kernel <linux-kernel@vger.kernel.org>
Subject: [PATCH] Allocate correct amount of memory for pid hash
Date: Mon, 6 Sep 2004 21:35:41 +1000	[thread overview]
Message-ID: <20040906113541.GR7716@krispykreme> (raw)
In-Reply-To: <4128252E.1080002@yahoo.com.au>


Hi Nick,

> Use hlists for the PID hashes. This halves the memory footprint of these
> hashes. No benchmarks, but I think this is a worthy improvement because
> the hashes are something that would be likely to have significant portions
> loaded into the cache of every CPU on some workloads.
> 
> This comes at the "expense" of
> 	1. reintroducing the memory  prefetch into the hash traversal loop;
> 	2. adding new pids to the head of the list instead of the tail. I
> 	   suspect that if this was a big problem then the hash isn't sized
> 	   well or could benefit from moving hot entries to the head.
> 
> Also, account for all the pid hashes when reporting hash memory usage.

It looks like we are now allocating twice as much memory as required.
How does this look?

Signed-off-by: Anton Blanchard <anton@samba.org>

diff -puN kernel/pid.c~fix_freemem_reporting kernel/pid.c
--- foobar2/kernel/pid.c~fix_freemem_reporting	2004-09-06 21:17:34.185012321 +1000
+++ foobar2-anton/kernel/pid.c	2004-09-06 21:25:29.494818586 +1000
@@ -278,7 +278,7 @@ void __init pidhash_init(void)
 
 	for (i = 0; i < PIDTYPE_MAX; i++) {
 		pid_hash[i] = alloc_bootmem(pidhash_size *
-					sizeof(struct list_head));
+					sizeof(struct hlist_head));
 		if (!pid_hash[i])
 			panic("Could not alloc pidhash!\n");
 		for (j = 0; j < pidhash_size; j++)
_

  parent reply	other threads:[~2004-09-06 11:38 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-08-22  4:44 [PATCH 1/2] fix PID hash sizing Nick Piggin
2004-08-22  4:46 ` [PATCH 2/2] use hlist for pid hash Nick Piggin
2004-08-22  5:00   ` David S. Miller
2004-08-22  5:31     ` Nick Piggin
2004-08-22  5:25   ` Ryan Cumming
2004-08-22  5:26     ` Nick Piggin
2004-09-06 11:35   ` Anton Blanchard [this message]
2004-09-06 11:41     ` [PATCH] Allocate correct amount of memory " Nick Piggin
2004-08-22 12:32 ` [PATCH 1/2] fix PID hash sizing William Lee Irwin III
2004-08-23  0:16   ` Nick Piggin

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=20040906113541.GR7716@krispykreme \
    --to=anton@samba.org \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nickpiggin@yahoo.com.au \
    /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.