All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Dumazet <dada1@cosmosbay.com>
To: Andrew Morton <akpm@osdl.org>
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] reduce sizeof(percpu_data) and removes dependance against NR_CPUS
Date: Thu, 05 Jan 2006 14:49:58 +0100	[thread overview]
Message-ID: <43BD2406.2040007@cosmosbay.com> (raw)
In-Reply-To: <20060105021929.498f45ef.akpm@osdl.org>

[-- Attachment #1: Type: text/plain, Size: 426 bytes --]

Hi Andrew

Current sizeof(percpu_data) is NR_CPUS*sizeof(void *)

This trivial patch makes percpu_data real size depends on 
highest_possible_processor_id() instead of NR_CPUS

percpu_data allocations are not performance critical, we can spend few CPU 
cycles and save some ram.

This patch should replace remove-unused-blkp-field-in-percpu_data.patch in mm tree

Thank you

Signed-off-by: Eric Dumazet <dada1@cosmosbay.com>


[-- Attachment #2: shrink_percpu_data.patch --]
[-- Type: text/plain, Size: 783 bytes --]

--- linux-2.6.15/include/linux/percpu.h	2006-01-03 04:21:10.000000000 +0100
+++ linux-2.6.15-edum/include/linux/percpu.h	2006-01-05 14:45:48.000000000 +0100
@@ -18,8 +18,7 @@
 #ifdef CONFIG_SMP
 
 struct percpu_data {
-	void *ptrs[NR_CPUS];
-	void *blkp;
+	void *ptrs[1]; /* real size depends on highest_possible_processor_id() */
 };
 
 /* 
--- linux-2.6.15/mm/slab.c	2006-01-03 04:21:10.000000000 +0100
+++ linux-2.6.15-edum/mm/slab.c	2006-01-05 14:37:13.000000000 +0100
@@ -2949,7 +2949,8 @@
 void *__alloc_percpu(size_t size, size_t align)
 {
 	int i;
-	struct percpu_data *pdata = kmalloc(sizeof (*pdata), GFP_KERNEL);
+	size_t pdsize = highest_possible_processor_id() * sizeof(void *);
+	struct percpu_data *pdata = kmalloc(pdsize, GFP_KERNEL);
 
 	if (!pdata)
 		return NULL;

  parent reply	other threads:[~2006-01-05 13:50 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-12-22 11:42 [PATCH] Debug shared irqs David Woodhouse
2006-01-05 10:19 ` Andrew Morton
2006-01-05 10:39   ` David Woodhouse
2006-01-05 11:08     ` Andrew Morton
2006-01-05 10:48   ` Arjan van de Ven
2006-01-05 13:49   ` Eric Dumazet [this message]
2006-01-05 14:00     ` [PATCH] reduce sizeof(percpu_data) and removes dependance against NR_CPUS Andrew Morton
2006-01-05 14:33       ` Eric Dumazet
2006-01-06  7:18     ` Jan Engelhardt
2006-01-06  7:27       ` Andrew Morton
2006-01-06  7:29       ` Eric Dumazet

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=43BD2406.2040007@cosmosbay.com \
    --to=dada1@cosmosbay.com \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.