mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Richard Kennedy <richard@rsk.demon.co.uk>
To: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: lkml <linux-kernel@vger.kernel.org>
Subject: [PATCH] perf: reorder perf_event_context to remove 8 bytes of padding on 64 bit builds
Date: Tue, 15 May 2012 12:52:06 +0100	[thread overview]
Message-ID: <1337082726.1898.14.camel@castor.rsk> (raw)

Reorder structure perf_event_context to remove 8 bytes of padding on 64
bit builds, which also shrinks structure perf_cpu_context by 8 bytes.
Reducing its size to 256 bytes so allowing it to fit into one fewer
cache lines.
    
Signed-off-by: Richard Kennedy <richard@rsk.demon.co.uk>

----
patch against v3.4-rc7
compiled and tested on x86_64

I have given this patch some light testing and perf still seems to work
OK.

perf_pin_task_context() increments both the pin_count and the refcount
so it seems a sensible place to put pin_count so there isn't any padding
after refcount. Obviously we can reorder this structure in other ways if
you prefer.

regards
Richard


diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index ddbb6a9..964c0cf 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -1027,6 +1027,7 @@ struct perf_event_context {
 	int				nr_freq;
 	int				rotate_disable;
 	atomic_t			refcount;
+	int				pin_count;
 	struct task_struct		*task;
 
 	/*
@@ -1036,13 +1037,12 @@ struct perf_event_context {
 	u64				timestamp;
 
 	/*
-	 * These fields let us detect when two contexts have both
-	 * been cloned (inherited) from a common ancestor.
+	 * These fields (with pin_count) let us detect when two contexts
+	 * have both been cloned (inherited) from a common ancestor.
 	 */
 	struct perf_event_context	*parent_ctx;
 	u64				parent_gen;
 	u64				generation;
-	int				pin_count;
 	int				nr_cgroups;	 /* cgroup evts */
 	int				nr_branch_stack; /* branch_stack evt */
 	struct rcu_head			rcu_head;



                 reply	other threads:[~2012-05-15 11:52 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1337082726.1898.14.camel@castor.rsk \
    --to=richard@rsk.demon.co.uk \
    --cc=a.p.zijlstra@chello.nl \
    --cc=linux-kernel@vger.kernel.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

all inboxes | Powered by JetHome®