From: Eric Dumazet <dada1@cosmosbay.com>
To: akpm@osdl.org
Cc: Linux kernel <linux-kernel@vger.kernel.org>
Subject: [PATCH] reorder struct pipe_buf_operations
Date: Mon, 11 Dec 2006 22:23:44 +0100 [thread overview]
Message-ID: <457DCC60.3050006@cosmosbay.com> (raw)
In-Reply-To: <200612112027.kBBKR4nG006298@shell0.pdx.osdl.net>
[-- Attachment #1: Type: text/plain, Size: 910 bytes --]
Fields of struct pipe_buf_operations have not a precise layout (ie not
optimized to fit cache lines nor reduce cache line ping pongs)
The bufs[] array is *large* and is placed near the beginning of the structure,
so all following fields have a large offset. This is unfortunate because many
archs have smaller instructions when using small offsets relative to a base
register. On x86 for example, 7 bits offsets have smaller instruction lengths.
Moving bufs[] at the end of pipe_buf_operations permits all fields to have
small offsets, and reduce text size, and icache pressure.
# size vmlinux.pre vmlinux
text data bss dec hex filename
3268989 664356 492196 4425541 438745 vmlinux.pre
3268765 664356 492196 4425317 438665 vmlinux
So this patch reduces text size by 224 bytes on my x86_64 machine. Similar
results on ia32.
Signed-off-by: Eric Dumazet <dada1@cosmosbay.com>
[-- Attachment #2: reorder_pipe_inode_info.patch --]
[-- Type: text/plain, Size: 670 bytes --]
--- linux-2.6.19/include/linux/pipe_fs_i.h 2006-12-11 23:06:57.000000000 +0100
+++ linux-2.6.19-ed/include/linux/pipe_fs_i.h 2006-12-11 22:58:42.000000000 +0100
@@ -41,7 +41,6 @@ struct pipe_buf_operations {
struct pipe_inode_info {
wait_queue_head_t wait;
unsigned int nrbufs, curbuf;
- struct pipe_buffer bufs[PIPE_BUFFERS];
struct page *tmp_page;
unsigned int readers;
unsigned int writers;
@@ -51,6 +50,7 @@ struct pipe_inode_info {
struct fasync_struct *fasync_readers;
struct fasync_struct *fasync_writers;
struct inode *inode;
+ struct pipe_buffer bufs[PIPE_BUFFERS];
};
/* Differs from PIPE_BUF in that PIPE_SIZE is the length of the actual
next parent reply other threads:[~2006-12-11 21:45 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <200612112027.kBBKR4nG006298@shell0.pdx.osdl.net>
2006-12-11 21:23 ` Eric Dumazet [this message]
2006-12-11 22:58 ` [PATCH] Introduce jiffies_32 and related compare functions Eric Dumazet
2006-12-12 1:31 ` David Miller
2006-12-12 3:47 ` Eric Dumazet
2006-12-12 3:57 ` David Miller
2006-12-12 4:09 ` Eric Dumazet
2006-12-12 4:27 ` David Miller
2006-12-12 6:56 ` Eric Dumazet
2006-12-12 8:00 ` David Miller
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=457DCC60.3050006@cosmosbay.com \
--to=dada1@cosmosbay.com \
--cc=akpm@osdl.org \
--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