netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] use total_highpages when calculating lowmem-only allocation sizes (dccp)
@ 2010-12-06 16:42 Jan Beulich
  2010-12-06 17:36 ` David Miller
  0 siblings, 1 reply; 4+ messages in thread
From: Jan Beulich @ 2010-12-06 16:42 UTC (permalink / raw)
  To: netdev; +Cc: akpm

For those (large) table allocations that come only from lowmem, the
total amount of memory shouldn't really matter.

Signed-off-by: Jan Beulich <jbeulich@novell.com>

---
 net/dccp/proto.c                  |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

--- linux-2.6.37-rc4/net/dccp/proto.c
+++ 2.6.37-rc4-use-totalhigh_pages/net/dccp/proto.c
@@ -14,6 +14,7 @@
 #include <linux/types.h>
 #include <linux/sched.h>
 #include <linux/kernel.h>
+#include <linux/highmem.h>
 #include <linux/skbuff.h>
 #include <linux/netdevice.h>
 #include <linux/in.h>
@@ -1068,10 +1069,11 @@ static int __init dccp_init(void)
 	 *
 	 * The methodology is similar to that of the buffer cache.
 	 */
-	if (totalram_pages >= (128 * 1024))
-		goal = totalram_pages >> (21 - PAGE_SHIFT);
+	goal = totalram_pages - totalhigh_pages;
+	if (goal >= (128 * 1024))
+		goal >>= 21 - PAGE_SHIFT;
 	else
-		goal = totalram_pages >> (23 - PAGE_SHIFT);
+		goal >>= 23 - PAGE_SHIFT;
 
 	if (thash_entries)
 		goal = (thash_entries *




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] use total_highpages when calculating lowmem-only allocation sizes (dccp)
  2010-12-06 16:42 [PATCH] use total_highpages when calculating lowmem-only allocation sizes (dccp) Jan Beulich
@ 2010-12-06 17:36 ` David Miller
  2010-12-07 14:38   ` Jan Beulich
  0 siblings, 1 reply; 4+ messages in thread
From: David Miller @ 2010-12-06 17:36 UTC (permalink / raw)
  To: JBeulich; +Cc: netdev, akpm

From: "Jan Beulich" <JBeulich@novell.com>
Date: Mon, 06 Dec 2010 16:42:46 +0000

> For those (large) table allocations that come only from lowmem, the
> total amount of memory shouldn't really matter.
> 
> Signed-off-by: Jan Beulich <jbeulich@novell.com>

Instead of continually tweaking the bits in these code paths,
we should be converting them over to using a central routine
such as alloc_large_system_hash() where the logic is consolidated
_AND_ the code knows to use vmalloc() and NUMA aware allocations
when warranted.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] use total_highpages when calculating lowmem-only allocation sizes (dccp)
  2010-12-06 17:36 ` David Miller
@ 2010-12-07 14:38   ` Jan Beulich
  2010-12-08  0:49     ` David Miller
  0 siblings, 1 reply; 4+ messages in thread
From: Jan Beulich @ 2010-12-07 14:38 UTC (permalink / raw)
  To: David Miller; +Cc: akpm, netdev

>>> On 06.12.10 at 18:36, David Miller <davem@davemloft.net> wrote:
> From: "Jan Beulich" <JBeulich@novell.com>
> Date: Mon, 06 Dec 2010 16:42:46 +0000
> 
>> For those (large) table allocations that come only from lowmem, the
>> total amount of memory shouldn't really matter.
>> 
>> Signed-off-by: Jan Beulich <jbeulich@novell.com>
> 
> Instead of continually tweaking the bits in these code paths,
> we should be converting them over to using a central routine
> such as alloc_large_system_hash() where the logic is consolidated
> _AND_ the code knows to use vmalloc() and NUMA aware allocations
> when warranted.

Hmm, not sure. For one, alloc_large_system_hash() is (and imo
ought to remain) an __init function. Second, looking at the one
non-modular case (netlink_proto_init()), I don't think using this
function would be the intention here.

Jan


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] use total_highpages when calculating lowmem-only allocation sizes (dccp)
  2010-12-07 14:38   ` Jan Beulich
@ 2010-12-08  0:49     ` David Miller
  0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2010-12-08  0:49 UTC (permalink / raw)
  To: JBeulich; +Cc: akpm, netdev

From: "Jan Beulich" <JBeulich@novell.com>
Date: Tue, 07 Dec 2010 14:38:21 +0000

>>>> On 06.12.10 at 18:36, David Miller <davem@davemloft.net> wrote:
>> From: "Jan Beulich" <JBeulich@novell.com>
>> Date: Mon, 06 Dec 2010 16:42:46 +0000
>> 
>>> For those (large) table allocations that come only from lowmem, the
>>> total amount of memory shouldn't really matter.
>>> 
>>> Signed-off-by: Jan Beulich <jbeulich@novell.com>
>> 
>> Instead of continually tweaking the bits in these code paths,
>> we should be converting them over to using a central routine
>> such as alloc_large_system_hash() where the logic is consolidated
>> _AND_ the code knows to use vmalloc() and NUMA aware allocations
>> when warranted.
> 
> Hmm, not sure. For one, alloc_large_system_hash() is (and imo
> ought to remain) an __init function. Second, looking at the one
> non-modular case (netlink_proto_init()), I don't think using this
> function would be the intention here.

I think the one and only reason DCCP and friends do not use this
interface is exactly because it's not available to modules.

So much (partially incorrect, as you found) code would be removed
if this common routine were exported and utilized.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-12-08  0:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-06 16:42 [PATCH] use total_highpages when calculating lowmem-only allocation sizes (dccp) Jan Beulich
2010-12-06 17:36 ` David Miller
2010-12-07 14:38   ` Jan Beulich
2010-12-08  0:49     ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).