public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@osdl.org>
To: David Howells <dhowells@redhat.com>
Cc: torvalds@osdl.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Permit inode & dentry hash tables to be allocated > MAX_ORDER size [#2]
Date: Fri, 11 Jun 2004 15:01:10 -0700	[thread overview]
Message-ID: <20040611150110.73fadefb.akpm@osdl.org> (raw)
In-Reply-To: <6567.1086963705@redhat.com>

David Howells <dhowells@redhat.com> wrote:
>
> Here's an update to my patch.

-static void __init dcache_init(unsigned long mempages)
+static void __init dcache_init_early(void)
 {
-	struct hlist_head *d;
-	unsigned long order;
-	unsigned int nr_hash;
-	int i;
+	struct hlist_head *p;
+	int loop;
+
+	dentry_hashtable =
+		alloc_large_system_hash("Dentry cache",
+					sizeof(struct hlist_head),
+					dhash_entries,
+					13,
+					0,
+					&d_hash_shift,
+					&d_hash_mask);
+
+	p = dentry_hashtable;
+	loop = 1 << d_hash_shift;
+	do {
+		INIT_HLIST_HEAD(p);
+		p++;
+		loop--;
+	} while (loop);
+}

We have an opportunity to make this loop less baroque.

	for (i = 0; i < (1 << d_hash_shift); i++)
		INIT_HLIST_HEAD(p[i]);




+void __init vfs_caches_init_early(void)

This function was declared

+extern void vfs_caches_init_early(void);

whereas in other places you _have_ made the definition of __init functions
include the "__init".  I'm not sure which is best, really, but it seems
better to include the __init in the declaration.

+static inline int log2(unsigned long x) __attribute__((pure));

What's the attribute((pure)) for?

It generates a warning on older gcc - please use __attribute_pure__.

+static inline int log2(unsigned long x)

This is just asking for namespace collisions.

+{
+	int r = 0;
+	for (x >>= 1; x > 0; x >>= 1)
+		r++;
+	return r;
+}

The other four or five implementations of log2() use ffx(~n).


  reply	other threads:[~2004-06-11 21:58 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-06-11 10:44 [PATCH] Permit inode & dentry hash tables to be allocated > MAX_ORDER size David Howells
2004-06-11 10:48 ` Andrew Morton
2004-06-11 11:12   ` David Howells
2004-06-11 22:04     ` Andrew Morton
2004-06-11 23:03       ` Martin J. Bligh
2004-06-11 23:19         ` Andrew Morton
2004-06-11 23:18           ` Martin J. Bligh
2004-06-11 23:30             ` Andrew Morton
2004-06-12 12:45               ` Andy Whitcroft
2004-06-13 16:09           ` Linus Torvalds
2004-06-11 14:21 ` [PATCH] Permit inode & dentry hash tables to be allocated > MAX_ORDER size [#2] David Howells
2004-06-11 22:01   ` Andrew Morton [this message]
2004-06-14 10:47     ` [PATCH] Permit inode & dentry hash tables to be allocated > MAX_ORDER size [try #3] David Howells
2004-06-14 11:04       ` Andrew Morton
2004-06-14 11:41         ` 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=20040611150110.73fadefb.akpm@osdl.org \
    --to=akpm@osdl.org \
    --cc=dhowells@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@osdl.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