[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <51272257.7050907@oberhumer.com>
Date: Fri, 22 Feb 2013 08:46:31 +0100
From: "Markus F.X.J. Oberhumer" <markus@...rhumer.com>
To: Bojan Smojver <bojan@...ursive.com>, Pavel Machek <pavel@....cz>,
"Rafael J. Wysocki" <rjw@...k.pl>
CC: LKML <linux-kernel@...r.kernel.org>
Subject: [PATCH] PM: align buffers for LZO compression
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@...rhumer.com>
--
Markus Oberhumer, <markus@...rhumer.com>, http://www.oberhumer.com/
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists