diff mbox

[1/3] pstore: Adjust buffer size for compression for smaller registered buffers

Message ID 20130911120639.27730.8671.stgit@aruna-ThinkPad-T420 (mailing list archive)
State Not Applicable
Headers show

Commit Message

Aruna Balakrishnaiah Sept. 11, 2013, 12:07 p.m. UTC
When backends (ex: efivars) have smaller registered buffers, the big_oops_buf
is quite too big for them as number of repeated occurences in the text captured
will be less. Patch takes care of adjusting the buffer size based on the
registered buffer size. cmpr values has been arrived after doing experiments with
plain text for buffers of size 1k - 4k (Smaller the buffer size repeated occurence
will be less) and with sample crash log for buffers ranging from 4k - 10k.

Reported-by: Seiji Aguchi <seiji.aguchi@hds.com>
Signed-off-by: Aruna Balakrishnaiah <aruna@linux.vnet.ibm.com>
---
 fs/pstore/platform.c |   23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

Comments

Luck, Tony Sept. 11, 2013, 6:34 p.m. UTC | #1
-	big_oops_buf_sz = (psinfo->bufsize * 100) / 45;
+	big_oops_buf_sz = (psinfo->bufsize * 100) / cmpr;

Tested on an ERST backed system.  Seems to be working (we save a little less information
per ERST record than before this change (uncompressed size goes down from ~17500 to
~16400 bytes) - but this patch switched the denominator from 45 to 48 (for ERST) - so that
seems plausible.

Seiji: let me know how the efivars tests go.

-Tony
Seiji Aguchi Sept. 11, 2013, 6:57 p.m. UTC | #2
>+	/* buffer range for efivars */
>+	case 1000 ... 2000:
>+		cmpr = 56;
>+		break;

> Seiji: let me know how the efivars tests go.

efivars works fine.
Uncompressed size about 1800 bytes. It matches the value of cmpr, 56. 

Please feel free to add my "Tested-by" to all three patches.

Tested-by: Seiji Aguchi <seiji.aguchi@hds.com>
diff mbox

Patch

diff --git a/fs/pstore/platform.c b/fs/pstore/platform.c
index 4ffb7ab..4efaa75 100644
--- a/fs/pstore/platform.c
+++ b/fs/pstore/platform.c
@@ -195,8 +195,29 @@  error:
 static void allocate_buf_for_compression(void)
 {
 	size_t size;
+	size_t cmpr;
+
+	switch (psinfo->bufsize) {
+	/* buffer range for efivars */
+	case 1000 ... 2000:
+		cmpr = 56;
+		break;
+	case 2001 ... 3000:
+		cmpr = 54;
+		break;
+	case 3001 ... 3999:
+		cmpr = 52;
+		break;
+	/* buffer range for nvram, erst */
+	case 4000 ... 10000:
+		cmpr = 48;
+		break;
+	default:
+		cmpr = 60;
+		break;
+	}
 
-	big_oops_buf_sz = (psinfo->bufsize * 100) / 45;
+	big_oops_buf_sz = (psinfo->bufsize * 100) / cmpr;
 	big_oops_buf = kmalloc(big_oops_buf_sz, GFP_KERNEL);
 	if (big_oops_buf) {
 		size = max(zlib_deflate_workspacesize(WINDOW_BITS, MEM_LEVEL),