Received: from mnm [127.0.0.1]
	by localhost with POP3 (fetchmail-5.9.0)
	for akpm@localhost (single-drop); Thu, 24 Apr 2003 07:47:34 -0700 (PDT)
Received: from digeo-e2k04.digeo.com ([192.168.2.24]) by pao-ex01.pao.digeo.com with Microsoft SMTPSVC(5.0.2195.5329);
	 Thu, 24 Apr 2003 07:42:36 -0700
Received: from digeo-nav01.digeo.com ([192.168.1.233]) by digeo-e2k04.digeo.com with Microsoft SMTPSVC(5.0.2195.5329);
	 Thu, 24 Apr 2003 07:42:35 -0700
Received: from packet.digeo.com ([192.168.17.15])
 by digeo-nav01.digeo.com (SAVSMTP 3.0.0.44) with SMTP id M2003042407443906429
 for <akpm@digeo.com>; Thu, 24 Apr 2003 07:44:39 -0700
Received: from angband.namesys.com (angband.namesys.com [212.16.7.85])
	by packet.digeo.com (8.12.8/8.12.8) with ESMTP id h3OEgWkR022134
	for <akpm@digeo.com>; Thu, 24 Apr 2003 07:42:33 -0700 (PDT)
Received: by angband.namesys.com (Postfix, from userid 521)
	id 4A0F655408B; Thu, 24 Apr 2003 18:42:31 +0400 (MSD)
Date: Thu, 24 Apr 2003 18:42:31 +0400
From: Oleg Drokin <green@namesys.com>
To: akpm@digeo.com, user-mode-linux-devel@lists.sourceforge.net,
   jdike@karaya.com
Subject: percpu counters cause UML compilation errors in with SMP
Message-ID: <20030424144231.GA3212@namesys.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
User-Agent: Mutt/1.4i
X-Scanned-By: MIMEDefang 2.30 (www . roaringpenguin . com / mimedefang)
X-OriginalArrivalTime: 24 Apr 2003 14:42:35.0124 (UTC) FILETIME=[BE8FAB40:01C30A6F]
X-Spam-Status: No, hits=-12.4 required=6.0
	tests=PATCH_UNIFIED_DIFF,USER_AGENT_MUTT
	autolearn=ham version=2.53
X-Spam-Level: 
X-Spam-Checker-Version: SpamAssassin 2.53 (1.174.2.15-2003-03-30-exp)

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	green@angband.namesys.com	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)
 {
