linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: John Levon <levon@movementarian.org>
To: torvalds@osdl.org, linux-kernel@vger.kernel.org, ak@suse.de
Cc: oprofile-list@lists.sf.net
Subject: [PATCH] OProfile: dynamically allocate MSR struct
Date: Mon, 14 Jul 2003 16:17:28 +0100	[thread overview]
Message-ID: <20030714151727.GA69617@compsoc.man.ac.uk> (raw)


Andi pointed out to me that cpu_msrs was a source of bloat. Dynamically
allocate it instead. Tested on my SMP box.

Note that we could eventually use per cpu stuff here, but I'd like to
wait on that for now.

regards
john


diff -Naur -X dontdiff linux-cvs/arch/i386/oprofile/nmi_int.c linux-fixes/arch/i386/oprofile/nmi_int.c
--- linux-cvs/arch/i386/oprofile/nmi_int.c	2003-06-18 15:06:05.000000000 +0100
+++ linux-fixes/arch/i386/oprofile/nmi_int.c	2003-07-14 15:34:29.000000000 +0100
@@ -12,6 +12,7 @@
 #include <linux/smp.h>
 #include <linux/oprofile.h>
 #include <linux/sysdev.h>
+#include <linux/slab.h>
 #include <asm/nmi.h>
 #include <asm/msr.h>
 #include <asm/apic.h>
@@ -20,7 +21,7 @@
 #include "op_x86_model.h"
  
 static struct op_x86_model_spec const * model;
-static struct op_msrs cpu_msrs[NR_CPUS];
+static struct op_msrs * cpu_msrs;
 static unsigned long saved_lvtpc[NR_CPUS];
  
 static int nmi_start(void);
@@ -125,6 +126,10 @@
 
 static int nmi_setup(void)
 {
+	cpu_msrs = kmalloc(sizeof(struct op_msrs) * NR_CPUS, GFP_KERNEL);
+	if (!cpu_msrs)
+		return -ENOMEM;
+
 	/* We walk a thin line between law and rape here.
 	 * We need to be careful to install our NMI handler
 	 * without actually triggering any NMIs as this will
@@ -185,6 +190,7 @@
 	on_each_cpu(nmi_cpu_shutdown, NULL, 0, 1);
 	unset_nmi_callback();
 	enable_lapic_nmi_watchdog();
+	kfree(cpu_msrs);
 }
 
  

             reply	other threads:[~2003-07-14 15:12 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-07-14 15:17 John Levon [this message]
2003-07-14 15:54 ` [PATCH] OProfile: dynamically allocate MSR struct John Levon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20030714151727.GA69617@compsoc.man.ac.uk \
    --to=levon@movementarian.org \
    --cc=ak@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oprofile-list@lists.sf.net \
    --cc=torvalds@osdl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).