From: "Markus F.X.J. Oberhumer" <markus@oberhumer.com>
To: Bojan Smojver <bojan@rexursive.com>, Pavel Machek <pavel@ucw.cz>,
"Rafael J. Wysocki" <rjw@sisk.pl>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH] PM: align buffers for LZO compression
Date: Fri, 22 Feb 2013 08:46:31 +0100 [thread overview]
Message-ID: <51272257.7050907@oberhumer.com> (raw)
Hi,
for performance reasons I'd strongly suggest that you explicitly align all
buffers passed to the LZO compress and decompress functions.
Below is a small (and completely untested!) patch, but I think you
get the idea.
BTW, it might be even more beneficial (esp. for NUMA systems) to align *all*
individual unc/cmp/wrk pointers to a multiple of the PAGE_SIZE, but this would
require some code restructuring.
Cheers,
Markus
completely untested patch:
diff --git a/kernel/power/swap.c b/kernel/power/swap.c
index 7c33ed2..7af4293 100644
--- a/kernel/power/swap.c
+++ b/kernel/power/swap.c
@@ -532,9 +532,9 @@ struct cmp_data {
wait_queue_head_t done; /* compression done */
size_t unc_len; /* uncompressed length */
size_t cmp_len; /* compressed length */
- unsigned char unc[LZO_UNC_SIZE]; /* uncompressed buffer */
- unsigned char cmp[LZO_CMP_SIZE]; /* compressed buffer */
- unsigned char wrk[LZO1X_1_MEM_COMPRESS]; /* compression workspace */
+ unsigned char unc[LZO_UNC_SIZE] ____cacheline_aligned; /* uncompressed buffer */
+ unsigned char cmp[LZO_CMP_SIZE] ____cacheline_aligned; /* compressed buffer */
+ unsigned char wrk[LZO1X_1_MEM_COMPRESS] ____cacheline_aligned; /* compression workspace */
};
/**
@@ -1021,8 +1021,8 @@ struct dec_data {
wait_queue_head_t done; /* decompression done */
size_t unc_len; /* uncompressed length */
size_t cmp_len; /* compressed length */
- unsigned char unc[LZO_UNC_SIZE]; /* uncompressed buffer */
- unsigned char cmp[LZO_CMP_SIZE]; /* compressed buffer */
+ unsigned char unc[LZO_UNC_SIZE] ____cacheline_aligned; /* uncompressed buffer */
+ unsigned char cmp[LZO_CMP_SIZE] ____cacheline_aligned; /* compressed buffer */
};
/**
Signed-off-by: Markus F.X.J. Oberhumer <markus@oberhumer.com>
--
Markus Oberhumer, <markus@oberhumer.com>, http://www.oberhumer.com/
next reply other threads:[~2013-02-22 7:51 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-22 7:46 Markus F.X.J. Oberhumer [this message]
2013-02-23 0:32 ` [PATCH] PM: align buffers for LZO compression Bojan Smojver
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=51272257.7050907@oberhumer.com \
--to=markus@oberhumer.com \
--cc=bojan@rexursive.com \
--cc=linux-kernel@vger.kernel.org \
--cc=pavel@ucw.cz \
--cc=rjw@sisk.pl \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.