[PATCH] Making i/dhash_entries cmdline work as it use to.

From: Jose R. Santos
Date: Mon Jul 12 2004 - 13:01:56 EST


Hi David,

I was looking at your patch for >MAX_ORDER hash tables but it seems that
the patch limits the number of entries to what it thinks are good values
and the i/dhash_entries cmdline options can not exceed this. Any reason
for this? This seems to limit the usability of the patch on systems were
larger allocations that the ones the kernel calculates are desired.

Also, any particular reason why MAX_SYS_HASH_TABLE_ORDER was set to 14?
I am already seeing the need to go higher on my 64GB setup and was
wondering if this could be bumped up to 19.

I'm sending a patch that get the cmdline options working as the did before
where the could override the kernel calculations and increases
MAX_SYS_HASH_TABLE_ORDER to 19. Only tested on PPC64 at the moment.

Andrew - Could you consider this for inclusion into mainline?

Thanks,

-JRS

# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
# ChangeSet 1.1676 -> 1.1677
# mm/page_alloc.c 1.200 -> 1.201
# include/linux/mmzone.h 1.58 -> 1.59
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 04/07/12 jsantos@xxxxxxxxxxxxxxxxxx 1.1677
# - Make ihash_entries and dhash_entries cmdline options behave like they use to.
# - Change MAX_SYS_HASH_TABLE_ORDER to allow very large hashes on very LARGE memory systems.
# --------------------------------------------
#
diff -Nru a/include/linux/mmzone.h b/include/linux/mmzone.h
--- a/include/linux/mmzone.h Mon Jul 12 12:53:29 2004
+++ b/include/linux/mmzone.h Mon Jul 12 12:53:29 2004
@@ -26,10 +26,10 @@
* permitted by MAX_ORDER, so we allocate with the bootmem allocator, and are
* limited to this size
*/
-#if MAX_ORDER > 14
+#if MAX_ORDER > 19
#define MAX_SYS_HASH_TABLE_ORDER MAX_ORDER
#else
-#define MAX_SYS_HASH_TABLE_ORDER 14
+#define MAX_SYS_HASH_TABLE_ORDER 19
#endif

struct free_area {
diff -Nru a/mm/page_alloc.c b/mm/page_alloc.c
--- a/mm/page_alloc.c Mon Jul 12 12:53:29 2004
+++ b/mm/page_alloc.c Mon Jul 12 12:53:29 2004
@@ -2000,31 +2000,30 @@
unsigned int *_hash_shift,
unsigned int *_hash_mask)
{
- unsigned long mem, max, log2qty, size;
+ unsigned long max, log2qty, size;
void *table;

- /* round applicable memory size up to nearest megabyte */
- mem = consider_highmem ? nr_all_pages : nr_kernel_pages;
- mem += (1UL << (20 - PAGE_SHIFT)) - 1;
- mem >>= 20 - PAGE_SHIFT;
- mem <<= 20 - PAGE_SHIFT;
-
- /* limit to 1 bucket per 2^scale bytes of low memory (rounded up to
- * nearest power of 2 in size) */
- if (scale > PAGE_SHIFT)
- mem >>= (scale - PAGE_SHIFT);
- else
- mem <<= (PAGE_SHIFT - scale);
-
- mem = 1UL << (long_log2(mem) + 1);
+ /* allow the kernel cmdline to have a say */
+ if (!numentries) {
+ /* round applicable memory size up to nearest megabyte */
+ numentries = consider_highmem ? nr_all_pages : nr_kernel_pages;
+ numentries += (1UL << (20 - PAGE_SHIFT)) - 1;
+ numentries >>= 20 - PAGE_SHIFT;
+ numentries <<= 20 - PAGE_SHIFT;

+ /* limit to 1 bucket per 2^scale bytes of low memory */
+ if (scale > PAGE_SHIFT)
+ numentries >>= (scale - PAGE_SHIFT);
+ else
+ numentries <<= (PAGE_SHIFT - scale);
+ }
+ /* rounded up to nearest power of 2 in size) */
+ numentries = 1UL << (long_log2(numentries) + 1);
+
/* limit allocation size */
max = (1UL << (PAGE_SHIFT + MAX_SYS_HASH_TABLE_ORDER)) / bucketsize;
- if (max > mem)
- max = mem;

- /* allow the kernel cmdline to have a say */
- if (!numentries || numentries > max)
+ if (numentries > max)
numentries = max;

log2qty = long_log2(numentries);



-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/