Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp337092ybe; Wed, 4 Sep 2019 00:00:03 -0700 (PDT) X-Google-Smtp-Source: APXvYqyAHnVjepvP8CT6AdWw6nMq2JIYW4AiXzIN3hQlHMlmYq9xCp+JJSoMaqEm7GQQ1B8+tMak X-Received: by 2002:a62:7646:: with SMTP id r67mr22427492pfc.116.1567580403270; Wed, 04 Sep 2019 00:00:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567580403; cv=none; d=google.com; s=arc-20160816; b=WrBAjysr1syy+vS9DYAQNpI7+DTF5nZ7x5z6w5f3+GS0ugu+q9CIGw12dD/dsMMgy7 xlvwCqBMUdKVlSLFiAOVdIBdL2+K4Mm7sRuxpeMD0YO9p45Abb/VzjNW53mXUy6d1IMb mFLYbjqN7iBGqF31Js1/eZqkiX1/B/6jPxy0CJQ0egrYIFbQDQwwv6eyVwiGTa+39hqO IqixK5odAUocFnVhzDbVXDj2M9snaJIQbUGNY/YMJ38wGUpJm+khDd2RLurAdc0ROoHf xwgp2HSYTJoWePqvOh6YvsjoCB+vllYDsnGJTiXJnMxyY+acDLK8T753h1BBtRICyHpf Ialw== 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=tfv+2Du+NiK3fQwB26hEaviCGnYN7i8DA5Vx/xbsEbk=; b=idch2xEV7pNuNKnXVWj7uAvIOrTCOQU2NSFjynRPTs0vcZzzMXyqNT+v0O13aoqtFz fQxPSVyN3KiHJHcbHwu4yaM6u/+SxAUjDKoJF3b6SHQMDH3zBYzzp1cErYLQrk/D0Cfr 8d6TKD+t/uXzoFyypxdfu2b8nov0qWBLvg3MLPuS2ZtRJ/d1ro+kQ4/Hgz+GlC18kZQc YwC6KZuj6Ncw56V80fCs9NsLiuD+myBHq+bDi1aCBM6m9mFd0/9uK9ftR+8+gv6zQ22c EFTgQwkFnHApb0Cvl7Ba0koH2wkNrUiTlnl6jIVl9nKvO4r8eCvX9/SqJd6jn2MHUl8x yYdA== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i1si19163519pfc.227.2019.09.03.23.59.48; Wed, 04 Sep 2019 00:00:03 -0700 (PDT) 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728897AbfIDG5m (ORCPT + 99 others); Wed, 4 Sep 2019 02:57:42 -0400 Received: from mailgw02.mediatek.com ([210.61.82.184]:63038 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726045AbfIDG5m (ORCPT ); Wed, 4 Sep 2019 02:57:42 -0400 X-UUID: 0f275d29c86d4783ab7c06ab9ad722f7-20190904 X-UUID: 0f275d29c86d4783ab7c06ab9ad722f7-20190904 Received: from mtkcas07.mediatek.inc [(172.21.101.84)] by mailgw02.mediatek.com (envelope-from ) (Cellopoint E-mail Firewall v4.1.10 Build 0809 with TLS) with ESMTP id 879257244; Wed, 04 Sep 2019 14:57:38 +0800 Received: from mtkcas07.mediatek.inc (172.21.101.84) by mtkmbs08n1.mediatek.inc (172.21.101.55) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Wed, 4 Sep 2019 14:57:36 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkcas07.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Wed, 4 Sep 2019 14:57:36 +0800 From: Walter Wu To: Andrey Ryabinin , Alexander Potapenko , Dmitry Vyukov , Matthias Brugger , Andrew Morton , Thomas Gleixner , Michal Hocko , Josh Poimboeuf , Greg Kroah-Hartman CC: , , , , , , Walter Wu Subject: [PATCH 2/2] mm/page_owner: determine the last stack state of page with CONFIG_KASAN_DUMP_PAGE=y Date: Wed, 4 Sep 2019 14:57:36 +0800 Message-ID: <20190904065736.20736-1-walter-zh.wu@mediatek.com> X-Mailer: git-send-email 2.18.0 MIME-Version: 1.0 Content-Type: text/plain X-MTK: N Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When enable CONFIG_KASAN_DUMP_PAGE, then page_owner will record last stack, So we need to know the last stack is allocation or free state. Signed-off-by: Walter Wu --- mm/page_owner.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/mm/page_owner.c b/mm/page_owner.c index addcbb2ae4e4..2756adca250e 100644 --- a/mm/page_owner.c +++ b/mm/page_owner.c @@ -418,6 +418,12 @@ void __dump_page_owner(struct page *page) nr_entries = stack_depot_fetch(handle, &entries); pr_alert("page allocated via order %u, migratetype %s, gfp_mask %#x(%pGg)\n", page_owner->order, migratetype_names[mt], gfp_mask, &gfp_mask); +#ifdef CONFIG_KASAN_DUMP_PAGE + if ((unsigned long)page->flags & PAGE_FLAGS_CHECK_AT_PREP) + pr_info("Allocation stack of page:\n"); + else + pr_info("Free stack of page:\n"); +#endif stack_trace_print(entries, nr_entries, 0); if (page_owner->last_migrate_reason != -1) -- 2.18.0