From patchwork Fri Jan 13 15:48:50 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Thompson X-Patchwork-Id: 91454 Delivered-To: patches@linaro.org Received: by 10.182.3.34 with SMTP id 2csp193877obz; Fri, 13 Jan 2017 07:49:23 -0800 (PST) X-Received: by 10.31.212.2 with SMTP id l2mr8452699vkg.134.1484322563574; Fri, 13 Jan 2017 07:49:23 -0800 (PST) Return-Path: Received: from mail-wm0-x22c.google.com (mail-wm0-x22c.google.com. [2a00:1450:400c:c09::22c]) by mx.google.com with ESMTPS id l132si2504041wmf.2.2017.01.13.07.49.23 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 13 Jan 2017 07:49:23 -0800 (PST) Received-SPF: pass (google.com: domain of daniel.thompson@linaro.org designates 2a00:1450:400c:c09::22c as permitted sender) client-ip=2a00:1450:400c:c09::22c; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: domain of daniel.thompson@linaro.org designates 2a00:1450:400c:c09::22c as permitted sender) smtp.mailfrom=daniel.thompson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: by mail-wm0-x22c.google.com with SMTP id c85so70378194wmi.1 for ; Fri, 13 Jan 2017 07:49:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=m5l8bzAdQoIB3OfJYWbDm7dnELrs6rXcgwEOG/itmi0=; b=CZFSjxC5Ncm5vm5PTR6eGi4BjlvJPUo/oJNBdo9ufvEWFTyEw9CF/u04D40w+ylUWs UZNpeylsQxDeEZHNdHk6dTsRgfJHhxY17hx8Ua0fw0mz3b4HwiMku4ws965S4Thp4/17 H/mv/g2s/5x8BEAqECqfcMW88GeHICF6m4Pak= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=m5l8bzAdQoIB3OfJYWbDm7dnELrs6rXcgwEOG/itmi0=; b=ZG23C3ZLWwAocy73Z8+L9mejIOeBKivokcXfwOa8QxkTsJce7QVnAMkkEO6k/J+bq5 YSn88Aw1EP3C7RjyBP7k2ItzhULts3LMe8uyR+vtwY1Xe0bDHMHa32MefBalnVRUD8vP nDSB5bIum6YzsnrJo/zLbNpP+jdnkGTRLDiB7nlBjBjCVpCNRP0Z0xO3lbWl69ny97g3 KQCPiHEikqPEdNCY7boMnks5k82L7YHNsQ5dV5I5jyL1n6CjxRTJECzRKriB0m4sTnhV v4jRv3GnIfaaCh+aRFf8/Wht184rgzYmfCGXBU0jML4qDasn4tJwmCXn7dXGnRSK7p2W MmTw== X-Gm-Message-State: AIkVDXKRZ0skvJ3ZKsQlSB/tqEPWqHgg9avDJ9LQUfxVWvZzANSc1g+roxX2d3RM9f07MhSDvzQ= X-Received: by 10.28.145.210 with SMTP id t201mr2717550wmd.42.1484322563065; Fri, 13 Jan 2017 07:49:23 -0800 (PST) Return-Path: Received: from wychelm.lan (cpc87149-aztw31-2-0-cust149.18-1.cable.virginm.net. [77.101.221.150]) by smtp.gmail.com with ESMTPSA id w7sm5029099wmd.24.2017.01.13.07.49.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 13 Jan 2017 07:49:22 -0800 (PST) From: Daniel Thompson To: Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , Andrew Morton Cc: Daniel Thompson , linux-mm@kvack.org, linux-kernel@vger.kernel.org, patches@linaro.org Subject: [PATCH] slub: Trace free objects at KERN_INFO Date: Fri, 13 Jan 2017 15:48:50 +0000 Message-Id: <20170113154850.518-1-daniel.thompson@linaro.org> X-Mailer: git-send-email 2.9.3 Currently when trace is enabled (e.g. slub_debug=T,kmalloc-128 ) the trace messages are mostly output at KERN_INFO. However the trace code also calls print_section() to hexdump the head of a free object. This is hard coded to use KERN_ERR, meaning the console is deluged with trace messages even if we've asked for quiet. Fix this the obvious way but adding a level parameter to print_section(), allowing calls from the trace code to use the same trace level as other trace messages. Signed-off-by: Daniel Thompson --- mm/slub.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) -- 2.9.3 Acked-by: Christoph Lameter Acked-by: David Rientjes diff --git a/mm/slub.c b/mm/slub.c index 067598a00849..7aa6f433f4de 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -496,10 +496,11 @@ static inline int check_valid_pointer(struct kmem_cache *s, return 1; } -static void print_section(char *text, u8 *addr, unsigned int length) +static void print_section(char *level, char *text, u8 *addr, + unsigned int length) { metadata_access_enable(); - print_hex_dump(KERN_ERR, text, DUMP_PREFIX_ADDRESS, 16, 1, addr, + print_hex_dump(level, text, DUMP_PREFIX_ADDRESS, 16, 1, addr, length, 1); metadata_access_disable(); } @@ -636,14 +637,15 @@ static void print_trailer(struct kmem_cache *s, struct page *page, u8 *p) p, p - addr, get_freepointer(s, p)); if (s->flags & SLAB_RED_ZONE) - print_section("Redzone ", p - s->red_left_pad, s->red_left_pad); + print_section(KERN_ERR, "Redzone ", p - s->red_left_pad, + s->red_left_pad); else if (p > addr + 16) - print_section("Bytes b4 ", p - 16, 16); + print_section(KERN_ERR, "Bytes b4 ", p - 16, 16); - print_section("Object ", p, min_t(unsigned long, s->object_size, - PAGE_SIZE)); + print_section(KERN_ERR, "Object ", p, + min_t(unsigned long, s->object_size, PAGE_SIZE)); if (s->flags & SLAB_RED_ZONE) - print_section("Redzone ", p + s->object_size, + print_section(KERN_ERR, "Redzone ", p + s->object_size, s->inuse - s->object_size); if (s->offset) @@ -658,7 +660,8 @@ static void print_trailer(struct kmem_cache *s, struct page *page, u8 *p) if (off != size_from_object(s)) /* Beginning of the filler is the free pointer */ - print_section("Padding ", p + off, size_from_object(s) - off); + print_section(KERN_ERR, "Padding ", p + off, + size_from_object(s) - off); dump_stack(); } @@ -820,7 +823,7 @@ static int slab_pad_check(struct kmem_cache *s, struct page *page) end--; slab_err(s, page, "Padding overwritten. 0x%p-0x%p", fault, end - 1); - print_section("Padding ", end - remainder, remainder); + print_section(KERN_ERR, "Padding ", end - remainder, remainder); restore_bytes(s, "slab padding", POISON_INUSE, end - remainder, end); return 0; @@ -973,7 +976,7 @@ static void trace(struct kmem_cache *s, struct page *page, void *object, page->freelist); if (!alloc) - print_section("Object ", (void *)object, + print_section(KERN_INFO, "Object ", (void *)object, s->object_size); dump_stack();