Subject: percpu counters cause UML compilation errors in with SMP
From: Oleg Drokin <[email-masked]>
To: [email-masked], [email-masked], [email-masked]
Date: Thu, 24 Apr 2003 18:42:31 +0400

Hello!

     The percpu counters break UML SMP compilation (in current 2.5.58 bk snapshot)
     (first NR_CPUS undeclared in header,
     then dereference of incomplete structure in .c file)
     This following patch helps to solve the problem. Please consider.

Bye,
    Oleg

# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
#	           ChangeSet	1.1127  -> 1.1128 
#	lib/percpu_counter.c	1.1     -> 1.2    
#	include/linux/percpu_counter.h	1.1     -> 1.2    
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 03/04/24	[email-masked]	1.1128
# percpu_counter.c, percpu_counter.h:
#   SMP compile fix
# --------------------------------------------
#
diff -Nru a/include/linux/percpu_counter.h b/include/linux/percpu_counter.h
--- a/include/linux/percpu_counter.h	Thu Apr 24 18:24:58 2003
+++ b/include/linux/percpu_counter.h	Thu Apr 24 18:24:58 2003
@@ -7,7 +7,7 @@
 #include <linux/config.h>
 #include <linux/spinlock.h>
 #include <linux/smp.h>
-#include <linux/preempt.h>
+#include <linux/threads.h>
 
 #ifdef CONFIG_SMP
 
diff -Nru a/lib/percpu_counter.c b/lib/percpu_counter.c
--- a/lib/percpu_counter.c	Thu Apr 24 18:24:58 2003
+++ b/lib/percpu_counter.c	Thu Apr 24 18:24:58 2003
@@ -1,5 +1,6 @@
 
 #include <linux/percpu_counter.h>
+#include <linux/sched.h>
 
 void percpu_counter_mod(struct percpu_counter *fbc, long amount)
 {