genirq: Adjust irq thread affinity on IRQ_SET_MASK_OK_NOCOPY return value
[linux-flexiantxendom0-3.2.10.git] / kernel / profile.c
index 1e6a0d9..76b8e77 100644 (file)
@@ -13,7 +13,7 @@
  *     to resolve timer interrupt livelocks, William Irwin, Oracle, 2004
  */
 
-#include <linux/module.h>
+#include <linux/export.h>
 #include <linux/profile.h>
 #include <linux/bootmem.h>
 #include <linux/notifier.h>
@@ -126,11 +126,9 @@ int __ref profile_init(void)
        if (prof_buffer)
                return 0;
 
-       prof_buffer = vmalloc(buffer_bytes);
-       if (prof_buffer) {
-               memset(prof_buffer, 0, buffer_bytes);
+       prof_buffer = vzalloc(buffer_bytes);
+       if (prof_buffer)
                return 0;
-       }
 
        free_cpumask_var(prof_cpu_mask);
        return -ENOMEM;
@@ -305,14 +303,12 @@ static void profile_discard_flip_buffers(void)
        mutex_unlock(&profile_flip_mutex);
 }
 
-void profile_hits(int type, void *__pc, unsigned int nr_hits)
+static void do_profile_hits(int type, void *__pc, unsigned int nr_hits)
 {
        unsigned long primary, secondary, flags, pc = (unsigned long)__pc;
        int i, j, cpu;
        struct profile_hit *hits;
 
-       if (prof_on != type || !prof_buffer)
-               return;
        pc = min((pc - (unsigned long)_stext) >> prof_shift, prof_len - 1);
        i = primary = (pc & (NR_PROFILE_GRP - 1)) << PROFILE_GRPSHIFT;
        secondary = (~(pc << 1) & (NR_PROFILE_GRP - 1)) << PROFILE_GRPSHIFT;
@@ -365,7 +361,7 @@ static int __cpuinit profile_cpu_callback(struct notifier_block *info,
        switch (action) {
        case CPU_UP_PREPARE:
        case CPU_UP_PREPARE_FROZEN:
-               node = cpu_to_node(cpu);
+               node = cpu_to_mem(cpu);
                per_cpu(cpu_profile_flip, cpu) = 0;
                if (!per_cpu(cpu_profile_hits, cpu)[1]) {
                        page = alloc_pages_exact_node(node,
@@ -419,16 +415,20 @@ out_free:
 #define profile_discard_flip_buffers() do { } while (0)
 #define profile_cpu_callback           NULL
 
-void profile_hits(int type, void *__pc, unsigned int nr_hits)
+static void do_profile_hits(int type, void *__pc, unsigned int nr_hits)
 {
        unsigned long pc;
-
-       if (prof_on != type || !prof_buffer)
-               return;
        pc = ((unsigned long)__pc - (unsigned long)_stext) >> prof_shift;
        atomic_add(nr_hits, &prof_buffer[min(pc, prof_len - 1)]);
 }
 #endif /* !CONFIG_SMP */
+
+void profile_hits(int type, void *__pc, unsigned int nr_hits)
+{
+       if (prof_on != type || !prof_buffer)
+               return;
+       do_profile_hits(type, __pc, nr_hits);
+}
 EXPORT_SYMBOL_GPL(profile_hits);
 
 void profile_tick(int type)
@@ -555,6 +555,7 @@ static ssize_t write_profile(struct file *file, const char __user *buf,
 static const struct file_operations proc_profile_operations = {
        .read           = read_profile,
        .write          = write_profile,
+       .llseek         = default_llseek,
 };
 
 #ifdef CONFIG_SMP
@@ -567,7 +568,7 @@ static int create_hash_tables(void)
        int cpu;
 
        for_each_online_cpu(cpu) {
-               int node = cpu_to_node(cpu);
+               int node = cpu_to_mem(cpu);
                struct page *page;
 
                page = alloc_pages_exact_node(node,