All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] PM: align buffers for LZO compression
@ 2013-02-22  7:46 Markus F.X.J. Oberhumer
  2013-02-23  0:32 ` Bojan Smojver
  0 siblings, 1 reply; 2+ messages in thread
From: Markus F.X.J. Oberhumer @ 2013-02-22  7:46 UTC (permalink / raw)
  To: Bojan Smojver, Pavel Machek, Rafael J. Wysocki; +Cc: LKML

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/

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] PM: align buffers for LZO compression
  2013-02-22  7:46 [PATCH] PM: align buffers for LZO compression Markus F.X.J. Oberhumer
@ 2013-02-23  0:32 ` Bojan Smojver
  0 siblings, 0 replies; 2+ messages in thread
From: Bojan Smojver @ 2013-02-23  0:32 UTC (permalink / raw)
  To: Markus F.X.J. Oberhumer, Pavel Machek, Rafael J. Wysocki; +Cc: LKML

"Markus F.X.J. Oberhumer" <markus@oberhumer.com> wrote:

>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.

Do you know what kind of performance gains should be expected from this?

--
Bojan

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-02-23  0:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-22  7:46 [PATCH] PM: align buffers for LZO compression Markus F.X.J. Oberhumer
2013-02-23  0:32 ` Bojan Smojver

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.