From 1e56c2bffcbd4e9e66a40cc1ab4fb7e80e564fc1 Mon Sep 17 00:00:00 2001 From: Thomas Schoebel-Theuer Date: Fri, 12 Apr 2013 14:13:21 +0200 Subject: [PATCH] client: avoid higher-order pages for hashing --- kernel/mars_client.c | 10 ++++++++++ kernel/mars_client.h | 4 +--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/kernel/mars_client.c b/kernel/mars_client.c index 9ceca781..2880e13e 100644 --- a/kernel/mars_client.c +++ b/kernel/mars_client.c @@ -16,6 +16,8 @@ #include "mars_client.h" +#define CLIENT_HASH_MAX (PAGE_SIZE / sizeof(struct list_head)) + ///////////////////////// own helper functions //////////////////////// static int thread_count = 0; @@ -672,6 +674,13 @@ static int client_brick_construct(struct client_brick *brick) static int client_output_construct(struct client_output *output) { int i; + + output->hash_table = brick_block_alloc(0, PAGE_SIZE); + if (unlikely(!output->hash_table)) { + MARS_ERR("cannot allocate hash table\n"); + return -ENOMEM; + } + for (i = 0; i < CLIENT_HASH_MAX; i++) { INIT_LIST_HEAD(&output->hash_table[i]); } @@ -691,6 +700,7 @@ static int client_output_destruct(struct client_output *output) brick_string_free(output->path); output->path = NULL; } + brick_block_free(output->hash_table, PAGE_SIZE); return 0; } diff --git a/kernel/mars_client.h b/kernel/mars_client.h index aa2f0406..e33a279e 100644 --- a/kernel/mars_client.h +++ b/kernel/mars_client.h @@ -8,8 +8,6 @@ extern struct mars_limiter client_limiter; extern int global_net_io_timeout; -#define CLIENT_HASH_MAX 256 - struct client_mref_aspect { GENERIC_ASPECT(mref); struct list_head io_head; @@ -59,7 +57,7 @@ struct client_output { wait_queue_head_t info_event; bool get_info; bool got_info; - struct list_head hash_table[CLIENT_HASH_MAX]; + struct list_head *hash_table; }; MARS_TYPES(client);