From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754372Ab3L0Kiz (ORCPT ); Fri, 27 Dec 2013 05:38:55 -0500 Received: from mta-out.inet.fi ([195.156.147.13]:35552 "EHLO jenni2.inet.fi" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754241Ab3L0Kix (ORCPT ); Fri, 27 Dec 2013 05:38:53 -0500 Date: Fri, 27 Dec 2013 12:38:47 +0200 From: "Kirill A. Shutemov" To: Sasha Levin Cc: akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mm: dump page when hitting a VM_BUG_ON using VM_BUG_ON_PAGE Message-ID: <20131227103847.GA19453@node.dhcp.inet.fi> References: <1388114452-30769-1-git-send-email-sasha.levin@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1388114452-30769-1-git-send-email-sasha.levin@oracle.com> User-Agent: Mutt/1.5.22.1-rc1 (2013-10-16) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Dec 26, 2013 at 10:20:52PM -0500, Sasha Levin wrote: > Most of the VM_BUG_ON assertions are performed on a page. Usually, when > one of these assertions fails we'll get a BUG_ON with a call stack and > the registers. > > I've recently noticed based on the requests to add a small piece of code > that dumps the page to various VM_BUG_ON sites that the page dump is quite > useful to people debugging issues in mm. > > This patch adds a VM_BUG_ON_PAGE(cond, page) which beyond doing what > VM_BUG_ON() does, also dumps the page before executing the actual BUG_ON. > > Signed-off-by: Sasha Levin I like the idea. One thing I've noticed you have a lot of page flag based asserts, like: VM_BUG_ON_PAGE(PageLRU(page), page); VM_BUG_ON_PAGE(!PageLocked(page), page); What about adding per-page-flag assert macros, like: PageNotLRU_assert(page); PageLocked_assert(page); ? This way we will always dump right page on bug. -- Kirill A. Shutemov