From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1946214Ab2LFRJV (ORCPT ); Thu, 6 Dec 2012 12:09:21 -0500 Received: from mail.eecsit.tu-berlin.de ([130.149.17.13]:65141 "EHLO mail.cs.tu-berlin.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1946199Ab2LFRJT (ORCPT ); Thu, 6 Dec 2012 12:09:19 -0500 From: =?UTF-8?q?Jan=20H=2E=20Sch=C3=B6nherr?= To: Greg Kroah-Hartman , Kay Sievers Cc: linux-kernel@vger.kernel.org, Joe Perches , Andrew Morton , Stephen Rothwell , =?UTF-8?q?Jan=20H=2E=20Sch=C3=B6nherr?= Subject: [PATCH v2 05/14] printk: reuse reclaimed continuation buffer immediately Date: Thu, 6 Dec 2012 18:06:02 +0100 Message-Id: <1354813571-11253-6-git-send-email-schnhrr@cs.tu-berlin.de> X-Mailer: git-send-email 1.8.0.1.20.g7c65b2e.dirty In-Reply-To: <1354813571-11253-1-git-send-email-schnhrr@cs.tu-berlin.de> References: <1354813571-11253-1-git-send-email-schnhrr@cs.tu-berlin.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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