Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp6022550imu; Mon, 21 Jan 2019 01:40:23 -0800 (PST) X-Google-Smtp-Source: ALg8bN5n0uBrgJ047k4EfcderWOIVnJml6dayYFgEuutIovAEMmga3NN1G9IZRR+dwyPkHZ9rvPX X-Received: by 2002:a63:e711:: with SMTP id b17mr26729652pgi.363.1548063623717; Mon, 21 Jan 2019 01:40:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548063623; cv=none; d=google.com; s=arc-20160816; b=EWq6/IR9wFAn9gHdsw4vSw1bKVYQxgaM2kjmtyaB5Qk8wtezBpj90AvCMtUqAPL3Xg TxtQYiLxNsz4yjmf8CCus9GBSiiLHl3aHwJAsBWbU4KP+4Vo2vJrm0hL3YHuK3AvJZYb VAiONzV7N0xf876Eys0tdfh/tTqb0oRTFzPZnwOQkRyiCt8JdGZjq2n6WjFApIodNJDd yqIdj03jeworu3DJG0FUg3EMp5VBSJELtSRG/OOaZ0ACQSeojf1ilaNfjsyONvaqHjPb ciB1Y4TbkijCA+hVLKjyBPJUc0A+8V1bgXeMP9VI40xxHIBzPNX79T58nAQDex6jDM4s CnhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from; bh=40fkhlvKt3exakgkZBKxTVwjvkc8X48HNmJX/i05Pkk=; b=QEHu+JyT7O2m1kokJ2tBHbZjRVSUS05ujIpFKO2tEv1nTzuN3Ok4APiw/3Pxg5qjVa F7Ko36kEPEPu+JCG3kA8B6E80eOP0aX8XodIVWp+CSPKbpCGXkEx2u4O9QiSk7uEw9ZL WNtXitpy5pGvlPXSH6ZpgLroEe9FiI9o3gGobXn9rUA96exYzSqo9GNdk1sSpmXYziXf rs093rHeOMq3Yv6C6W59gwaSh/JtHuZt8vKUJlaC1/lYOUPmQZFT9xKIrhUBWfqJ+QgK PKRYbf8pJ4Cr8sP/TuPm4kwVeF7GJKDVwp1IEVOdqVIh5MuLLpByDaHUWicKgHJXhY7p M9uQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g10si12085515plq.371.2019.01.21.01.40.08; Mon, 21 Jan 2019 01:40:23 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727880AbfAUJi1 (ORCPT + 99 others); Mon, 21 Jan 2019 04:38:27 -0500 Received: from mailgw01.mediatek.com ([210.61.82.183]:7371 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726133AbfAUJi0 (ORCPT ); Mon, 21 Jan 2019 04:38:26 -0500 X-UUID: e39555a8435f4724bbf3fb08b876d1b3-20190121 X-UUID: e39555a8435f4724bbf3fb08b876d1b3-20190121 Received: from mtkexhb01.mediatek.inc [(172.21.101.102)] by mailgw01.mediatek.com (envelope-from ) (mhqrelay.mediatek.com ESMTP with TLS) with ESMTP id 1215981584; Mon, 21 Jan 2019 17:38:14 +0800 Received: from mtkcas09.mediatek.inc (172.21.101.178) by mtkmbs08n2.mediatek.inc (172.21.101.56) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Mon, 21 Jan 2019 17:38:12 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkcas09.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Mon, 21 Jan 2019 17:38:12 +0800 From: To: Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , Andrew Morton CC: , , , Miles Chen Subject: [PATCH] mm/slub: use WARN_ON() for some slab errors Date: Mon, 21 Jan 2019 17:38:10 +0800 Message-ID: <1548063490-545-1-git-send-email-miles.chen@mediatek.com> X-Mailer: git-send-email 1.9.1 MIME-Version: 1.0 Content-Type: text/plain X-TM-SNTS-SMTP: 22854B56D5FA26CFEBB0D7CFF0AD17A8FEB7B10791F002CBBB518968530C57542000:8 X-MTK: N Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Miles Chen When debugging with slub.c, sometimes we have to trigger a panic in order to get the coredump file. To do that, we have to modify slub.c and rebuild kernel. To make debugging easier, use WARN_ON() for these slab errors so we can dump stack trace by default or set panic_on_warn to trigger a panic. Signed-off-by: Miles Chen --- mm/slub.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mm/slub.c b/mm/slub.c index 1e3d0ec4e200..e48c3bb30c93 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -684,7 +684,7 @@ static void print_trailer(struct kmem_cache *s, struct page *page, u8 *p) print_section(KERN_ERR, "Padding ", p + off, size_from_object(s) - off); - dump_stack(); + WARN_ON(1); } void object_err(struct kmem_cache *s, struct page *page, @@ -705,7 +705,7 @@ static __printf(3, 4) void slab_err(struct kmem_cache *s, struct page *page, va_end(args); slab_bug(s, "%s", buf); print_page_info(page); - dump_stack(); + WARN_ON(1); } static void init_object(struct kmem_cache *s, void *object, u8 val) @@ -1690,7 +1690,7 @@ static struct page *new_slab(struct kmem_cache *s, gfp_t flags, int node) flags &= ~GFP_SLAB_BUG_MASK; pr_warn("Unexpected gfp: %#x (%pGg). Fixing up to gfp: %#x (%pGg). Fix your code!\n", invalid_mask, &invalid_mask, flags, &flags); - dump_stack(); + WARN_ON(1); } return allocate_slab(s, -- 2.18.0