From: William Lee Irwin III <wli@holomorphy.com>

Convert prof_buffer to an array of atomic_t instead of sometimes atomic_t,
sometimes unsigned int.  Also, bootmem rounds up internally, so blow away some
crap code there.

Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 25-akpm/kernel/profile.c |   17 ++++++-----------
 1 files changed, 6 insertions(+), 11 deletions(-)

diff -puN kernel/profile.c~profile-make-prof_buffer-atomic_t kernel/profile.c
--- 25/kernel/profile.c~profile-make-prof_buffer-atomic_t	2004-08-15 12:08:27.071296264 -0700
+++ 25-akpm/kernel/profile.c	2004-08-15 12:08:27.074295808 -0700
@@ -12,7 +12,7 @@
 #include <linux/profile.h>
 #include <asm/sections.h>
 
-static unsigned int *prof_buffer;
+static atomic_t *prof_buffer;
 static unsigned long prof_len, prof_shift;
 static int prof_on;
 static cpumask_t prof_cpu_mask = CPU_MASK_ALL;
@@ -40,17 +40,12 @@ __setup("profile=", profile_setup);
 
 void __init profile_init(void)
 {
-	unsigned int size;
- 
 	if (!prof_on) 
 		return;
  
 	/* only text is profiled */
-	prof_len = _etext - _stext;
-	prof_len >>= prof_shift;
-		
-	size = prof_len * sizeof(unsigned int) + PAGE_SIZE - 1;
-	prof_buffer = (unsigned int *) alloc_bootmem(size);
+	prof_len = (_etext - _stext) >> prof_shift;
+	prof_buffer = alloc_bootmem(prof_len*sizeof(atomic_t));
 }
 
 /* Profile event notifications */
@@ -174,7 +169,7 @@ void profile_hit(int type, void *__pc)
 	if (prof_on != type || !prof_buffer)
 		return;
 	pc = ((unsigned long)__pc - (unsigned long)_stext) >> prof_shift;
-	atomic_inc((atomic_t *)&prof_buffer[min(pc, prof_len - 1)]);
+	atomic_inc(&prof_buffer[min(pc, prof_len - 1)]);
 }
 
 void profile_tick(int type, struct pt_regs *regs)
@@ -252,7 +247,7 @@ read_profile(struct file *file, char __u
 		put_user(*((char *)(&sample_step)+p),buf);
 		buf++; p++; count--; read++;
 	}
-	pnt = (char *)prof_buffer + p - sizeof(unsigned int);
+	pnt = (char *)prof_buffer + p - sizeof(atomic_t);
 	if (copy_to_user(buf,(void *)pnt,count))
 		return -EFAULT;
 	read += count;
@@ -283,7 +278,7 @@ static ssize_t write_profile(struct file
 	}
 #endif
 
-	memset(prof_buffer, 0, prof_len * sizeof(*prof_buffer));
+	memset(prof_buffer, 0, prof_len * sizeof(atomic_t));
 	return count;
 }
 
_