PM: align buffers for LZO compression
Subsystems (2)
PATCH 1/1 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:
kernel/power/swap.c +5 -5
@@ -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 */ };/**
Signature · 1 line
Markus Oberhumer, <[email protected]>, http://www.oberhumer.com/
Quoted 6 lines · Markus F.X.J. Oberhumer
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