login
Header Space

 
 

Re: [14/14] vcompound: Avoid vmalloc for ehash_locks

Previous thread: [09/14] vcompound: crypto: Fallback for temporary order 2 allocation by Christoph Lameter on Friday, March 21, 2008 - 2:17 am. (1 message)

Next thread: [13/14] vcompound: Use vcompound for swap_map by Christoph Lameter on Friday, March 21, 2008 - 2:17 am. (8 messages)
To: <linux-mm@...>
Cc: <linux-kernel@...>
Date: Friday, March 21, 2008 - 2:17 am

Avoid the use of vmalloc for the ehash locks.

Signed-off-by: Christoph Lameter &lt;clameter@sgi.com&gt;

---
 include/net/inet_hashtables.h |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Index: linux-2.6.25-rc5-mm1/include/net/inet_hashtables.h
===================================================================
--- linux-2.6.25-rc5-mm1.orig/include/net/inet_hashtables.h	2008-03-20 22:21:02.680501729 -0700
+++ linux-2.6.25-rc5-mm1/include/net/inet_hashtables.h	2008-03-20 22:22:15.416565317 -0700
@@ -164,7 +164,8 @@ static inline int inet_ehash_locks_alloc
 	if (sizeof(rwlock_t) != 0) {
 #ifdef CONFIG_NUMA
 		if (size * sizeof(rwlock_t) &gt; PAGE_SIZE)
-			hashinfo-&gt;ehash_locks = vmalloc(size * sizeof(rwlock_t));
+			hashinfo-&gt;ehash_locks = __alloc_vcompound(GFP_KERNEL,
+				get_order(size * sizeof(rwlock_t)));
 		else
 #endif
 		hashinfo-&gt;ehash_locks =	kmalloc(size * sizeof(rwlock_t),
@@ -185,7 +186,7 @@ static inline void inet_ehash_locks_free
 		unsigned int size = (hashinfo-&gt;ehash_locks_mask + 1) *
 							sizeof(rwlock_t);
 		if (size &gt; PAGE_SIZE)
-			vfree(hashinfo-&gt;ehash_locks);
+			__free_vcompound(hashinfo-&gt;ehash_locks);
 		else
 #endif
 		kfree(hashinfo-&gt;ehash_locks);

-- 
--
To: Christoph Lameter <clameter@...>
Cc: <linux-mm@...>, <linux-kernel@...>, Linux Netdev List <netdev@...>
Date: Friday, March 21, 2008 - 3:02 am

But, isnt it defeating the purpose of this *particular* vmalloc() use ?

CONFIG_NUMA and vmalloc() at boot time means :

Try to distribute the pages on several nodes.

Memory pressure on ehash_locks[] is so high we definitly want to spread it.

(for similar uses of vmalloc(), see also hashdist=1 )

Also, please CC netdev for network patches :)

Thank you

--
To: <dada1@...>
Cc: <clameter@...>, <linux-mm@...>, <linux-kernel@...>, <netdev@...>
Date: Friday, March 21, 2008 - 3:31 am

From: Eric Dumazet &lt;dada1@cosmosbay.com&gt;

I agree with Eric, converting any of the networking hash
allocations to this new facility is not the right thing
to do.
--
To: David Miller <davem@...>
Cc: <dada1@...>, <linux-mm@...>, <linux-kernel@...>, <netdev@...>
Date: Friday, March 21, 2008 - 1:31 pm

Ok. Going to drop it.
 
--
To: Eric Dumazet <dada1@...>
Cc: <linux-mm@...>, <linux-kernel@...>, Linux Netdev List <netdev@...>
Date: Friday, March 21, 2008 - 3:03 am

I thought that was controlled by hashdist? I did not see it used here and 
so I assumed that the RR was not intended here.
--
To: <clameter@...>
Cc: <dada1@...>, <linux-mm@...>, <linux-kernel@...>, <netdev@...>
Date: Friday, March 21, 2008 - 3:31 am

From: Christoph Lameter &lt;clameter@sgi.com&gt;

It's intended for all of the major networking hash tables.
--
To: David Miller <davem@...>
Cc: <clameter@...>, <linux-mm@...>, <linux-kernel@...>, <netdev@...>
Date: Friday, March 21, 2008 - 3:42 am

Other networking hash tables uses alloc_large_system_hash(), which handles 
hashdist settings.

But this helper is __init only, so we can not use it for ehash_locks (can be 
allocated by DCCP module)


--
Previous thread: [09/14] vcompound: crypto: Fallback for temporary order 2 allocation by Christoph Lameter on Friday, March 21, 2008 - 2:17 am. (1 message)

Next thread: [13/14] vcompound: Use vcompound for swap_map by Christoph Lameter on Friday, March 21, 2008 - 2:17 am. (8 messages)
speck-geostationary