[PATCH v2 05/14] printk: reuse reclaimed continuation buffer immediately

From: Jan H. SchÃnherr
Date: Thu Dec 06 2012 - 12:09:10 EST


cont_add() might flush the continuation buffer before appending
anything. If that happens, the function returns immediately, forcing the
calling function to store the message elsewhere. This is not always
necessary.

When the continuation buffer was reclaimed (and not just marked as
"flushed"), then we can reuse it immediately instead of returning false.

Signed-off-by: Jan H. SchÃnherr <schnhrr@xxxxxxxxxxxxxxx>
---
kernel/printk.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/kernel/printk.c b/kernel/printk.c
index f6a91ec..7328348 100644
--- a/kernel/printk.c
+++ b/kernel/printk.c
@@ -1430,7 +1430,8 @@ static bool cont_add(int facility, int level, enum log_flags flags,
if (cont.len + len > sizeof(cont.buf)) {
/* the line gets too long, split it up in separate records */
cont_flush();
- return false;
+ if (cont.len)
+ return false;
}

if (!cont.len) {
--
1.8.0.1.20.g7c65b2e.dirty

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/