Note that we can use the ptr ops on static percpu vars now. We should
remove the "per_cpu__" token-pasting which was designed to catch raw
usage, and use sparse annotations instead.Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Cc: Christoph Lameter <cl@linux-foundation.org>
---
include/linux/percpu.h | 2 +
init/Kconfig | 6 ++++
init/Makefile | 1
init/main.c | 1
init/test-cpualloc.c | 61 +++++++++++++++++++++++++++++++++++++++++++++++++
mm/allocpercpu.c | 7 ++---
6 files changed, 74 insertions(+), 4 deletions(-)diff -r 3b3fa686230f init/Kconfig
--- a/init/Kconfig Mon Nov 17 23:19:14 2008 +1030
+++ b/init/Kconfig Mon Nov 17 23:39:58 2008 +1030
@@ -929,3 +929,9 @@
designed for best read-side performance on non-realtime
systems. Classic RCU is the default. Note that the
PREEMPT_RCU symbol is used to select/deselect this option.
+
+config TEST_CPUALLOC
+ tristate "Test alloc_percpu"
+ depends on DEBUG_KERNEL
+ help
+ This tests the replacement alloc_percpu() implementation.
diff -r 3b3fa686230f init/Makefile
--- a/init/Makefile Mon Nov 17 23:19:14 2008 +1030
+++ b/init/Makefile Mon Nov 17 23:39:58 2008 +1030
@@ -9,6 +9,7 @@
obj-$(CONFIG_BLK_DEV_INITRD) += initramfs.o
endif
obj-$(CONFIG_GENERIC_CALIBRATE_DELAY) += calibrate.o
+obj-$(CONFIG_TEST_CPUALLOC) += test-cpualloc.omounts-y := do_mounts.o
mounts-$(CONFIG_BLK_DEV_RAM) += do_mounts_rd.o
diff -r 3b3fa686230f init/test-cpualloc.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/init/test-cpualloc.c Mon Nov 17 23:39:58 2008 +1030
@@ -0,0 +1,75 @@
+/* Not a very informative test: it just crashes if something's wrong. */
+#include <linux/percpu.h>
+#include <linux/module.h>
+
+static DEFINE_PER_CPU(u64, static_pcpu);
+
+static int init(void)
+{
+ void *p, *thisp;
+ u64 *p64, *thisp64;
+ unsigned int i;
+
+ printk(KERN_INFO "Testing cpualloc for %u cpus\n",
+ cpus_weight(cpu_possi...
Locking fixes. Locking was totally lacking for the mconsole_devices,
which got a spin lock, and the unplugged pages data, which got a
mutex.The locking of the mconsole console output code was confused. Now,
the console_lock (renamed to client_lock) protects the clients list.Signed-off-by: Jeff Dike <jdike@addtoit.com>
--
arch/um/drivers/mconsole_kern.c | 21 +++++++++++++++------
arch/um/drivers/net_kern.c | 1 +
arch/um/drivers/ssl.c | 1 +
arch/um/drivers/ubd_kern.c | 1 +
arch/um/kernel/tt/gdb_kern.c | 1 +
5 files changed, 19 insertions(+), 6 deletions(-)Index: linux-2.6.18-mm/arch/um/drivers/mconsole_kern.c
===================================================================
--- linux-2.6.18-mm.orig/arch/um/drivers/mconsole_kern.c 2007-01-01 11:32:22.000000000 -0500
+++ linux-2.6.18-mm/arch/um/drivers/mconsole_kern.c 2007-01-01 12:12:53.000000000 -0500
@@ -337,13 +337,15 @@ void mconsole_stop(struct mc_request *re
mconsole_reply(req, "", 0, 0);
}-/* This list is populated by __initcall routines. */
-
+static DEFINE_SPINLOCK(mc_devices_lock);
static LIST_HEAD(mconsole_devices);void mconsole_register_dev(struct mc_device *new)
{
+ spin_lock(&mc_devices_lock);
+ BUG_ON(!list_empty(&new->list));
list_add(&new->list, &mconsole_devices);
+ spin_unlock(&mc_devices_lock);
}static struct mc_device *mconsole_find_dev(char *name)
@@ -367,6 +369,7 @@ struct unplugged_pages {
void *pages[UNPLUGGED_PER_PAGE];
};+static DECLARE_MUTEX(plug_mem_mutex);
static unsigned long long unplugged_pages_count = 0;
static struct list_head unplugged_pages = LIST_HEAD_INIT(unplugged_pages);
static int unplug_index = UNPLUGGED_PER_PAGE;
@@ -402,6 +405,7 @@ static int mem_config(char *str, char **diff /= PAGE_SIZE;
+ down(&plug_mem_mutex);
for(i = 0; i < diff; i++){
struct unplugged_pages *unplugged;
void *addr;
@@ -447,7 +451,7 @@ static int mem_config(char *st...
| Srivatsa Vaddagiri | containers (was Re: -mm merge plans for 2.6.23) |
| Greg KH | [GIT PATCH] driver core patches against 2.6.24 |
| Tarkan Erimer | Re: Dual-Licensing Linux Kernel with GPL V2 and GPL V3 |
| Benjamin Herrenschmidt | Re: [PATCH] Remove process freezer from suspend to RAM pathway |
git: | |
| Jarek Poplawski | [PATCH take 2] pkt_sched: Protect gen estimators under est_lock. |
| David Miller | [GIT]: Networking |
| Gerhard Pircher | 3c59x: shared interrupt problem |
| Gerrit Renker | [PATCH 27/37] dccp: Integration of dynamic feature activation - part 2 (server side) |
