Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754204AbbHFPIV (ORCPT ); Thu, 6 Aug 2015 11:08:21 -0400 Received: from aserp1040.oracle.com ([141.146.126.69]:42991 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752820AbbHFPIU (ORCPT ); Thu, 6 Aug 2015 11:08:20 -0400 Message-ID: <55C37852.8030600@oracle.com> Date: Thu, 06 Aug 2015 11:08:02 -0400 From: Sasha Levin User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: David Rientjes CC: linux-mm@kvack.org, akpm@linux-foundation.org, linux-kernel@vger.kernel.org, kirill@shutemov.name Subject: Re: [PATCH 05/11] mm: debug: dump page into a string rather than directly on screen References: <1431623414-1905-1-git-send-email-sasha.levin@oracle.com> <1431623414-1905-6-git-send-email-sasha.levin@oracle.com> <55943DC1.6010209@oracle.com> <55946EA9.2080805@oracle.com> In-Reply-To: Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-Source-IP: userv0022.oracle.com [156.151.31.74] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1722 Lines: 48 On 07/08/2015 07:58 PM, David Rientjes wrote: > On Wed, 1 Jul 2015, Sasha Levin wrote: > >> > Since we'd BUG at VM_BUG_ON(), this would be something closer to: >> > >> > if (unlikely(compound_head(page) != head)) { >> > dump_page(page); >> > dump_page(head); >> > VM_BUG_ON(1); >> > } >> > > I was thinking closer to > > if (VM_WARN_ON(compound_head(page) != head)) { > ... > BUG(); > } > > so we prefix all output with the typical warning diagnostics, emit > whatever page, vma, etc output we want, and then finally die. The final > BUG() here would have to be replaced by something that suppresses the > repeated output. > > If it's really just a warning, then no BUG() needed. How is that simpler than getting it all under VM_BUG()? Just like the regular WARN() does. >> > But my point here was that while one *could* do it that way, no one does because >> > it's not intuitive. We both agree that in the example above it would be useful to >> > see both 'page' and 'head', and yet the code that was written didn't dump any of >> > them. Why? No one wants to write debug code unless it's easy and short. >> > > pr_alert("%pZp %pZv", page, vma) isn't shorter than dump_page(page); > dump_vma(vma), but it would be a line shorter. I'm not sure that the > former is easier, though, and it prevents us from ever expanding dump_*() > functions for conditional output. I'm not objecting to leaving dump_*() for these trivial cases. Thanks, Sasha -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/