From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E760FC433DF for ; Fri, 7 Aug 2020 22:40:30 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id A1A0622CBB for ; Fri, 7 Aug 2020 22:40:30 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=nvidia.com header.i=@nvidia.com header.b="YAApT+8M" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A1A0622CBB Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=nvidia.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 23B8A6B0007; Fri, 7 Aug 2020 18:40:30 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1EBCB6B000A; Fri, 7 Aug 2020 18:40:30 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0B38C6B000C; Fri, 7 Aug 2020 18:40:30 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0159.hostedemail.com [216.40.44.159]) by kanga.kvack.org (Postfix) with ESMTP id E8A236B0007 for ; Fri, 7 Aug 2020 18:40:29 -0400 (EDT) Received: from smtpin11.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 887B0181AEF0B for ; Fri, 7 Aug 2020 22:40:29 +0000 (UTC) X-FDA: 77125242978.11.note26_1801fb926fc4 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin11.hostedemail.com (Postfix) with ESMTP id 5A110180F8B80 for ; Fri, 7 Aug 2020 22:40:29 +0000 (UTC) X-HE-Tag: note26_1801fb926fc4 X-Filterd-Recvd-Size: 3700 Received: from hqnvemgate24.nvidia.com (hqnvemgate24.nvidia.com [216.228.121.143]) by imf39.hostedemail.com (Postfix) with ESMTP for ; Fri, 7 Aug 2020 22:40:28 +0000 (UTC) Received: from hqpgpgate102.nvidia.com (Not Verified[216.228.121.13]) by hqnvemgate24.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Fri, 07 Aug 2020 15:38:45 -0700 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate102.nvidia.com (PGP Universal service); Fri, 07 Aug 2020 15:40:27 -0700 X-PGP-Universal: processed; by hqpgpgate102.nvidia.com on Fri, 07 Aug 2020 15:40:27 -0700 Received: from [10.2.52.206] (10.124.1.5) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Fri, 7 Aug 2020 22:40:22 +0000 Subject: Re: [PATCH v2] mm, dump_page: do not crash with bad compound_mapcount() To: "Kirill A. Shutemov" , Matthew Wilcox CC: Andrew Morton , LKML , , , , , , "Kirill A . Shutemov" References: <20200804214807.169256-1-jhubbard@nvidia.com> <20200807143504.4kudtd4xeoqaroqg@box> <20200807151029.GE17456@casper.infradead.org> <20200807164805.xm4ingj4crdiemol@box> From: John Hubbard Message-ID: <2038d28f-0f65-5629-f033-e92c5c5e9798@nvidia.com> Date: Fri, 7 Aug 2020 15:40:21 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.11.0 MIME-Version: 1.0 In-Reply-To: <20200807164805.xm4ingj4crdiemol@box> X-Originating-IP: [10.124.1.5] X-ClientProxiedBy: HQMAIL111.nvidia.com (172.20.187.18) To HQMAIL107.nvidia.com (172.20.187.13) Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1596839925; bh=V8KL8V1OqjlOYNcn5ZdslPutD+BA8Q66zxQ3bPAosTs=; h=X-PGP-Universal:Subject:To:CC:References:From:Message-ID:Date: User-Agent:MIME-Version:In-Reply-To:X-Originating-IP: X-ClientProxiedBy:Content-Type:Content-Language: Content-Transfer-Encoding; b=YAApT+8MeT8HnTLuUyKnGmD/DTT1gJs7KAgtSTP7hcPox004MhFKDmQzU8dzfLC86 ixuquydWeMlJ6sjH0XBxljFydG3F2snZ32FrUs7tZBnMwayqhuGAs4Hmq/V7dYxJJ/ gLfVMC1xdMJ1I1jVBrZWGHmdOdBwj7D4Q/CT9vuniVTWNyv1PJ6fBGoJZrycOWscmn JFgjR277qKR1mVaTNRw9dUg9iVCuPqLeCoH65O9fj3F6tLIZZS0tE8ckLczvN+Yu8t 0h5JPEe7C19I2eMkpSq9+9fsa7m8wJLq5R6Vdq9cSyQpEWc3YdGR3QxrzktyRhG6Tn 5qWsKNKmeXMzw== X-Rspamd-Queue-Id: 5A110180F8B80 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam01 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 8/7/20 9:48 AM, Kirill A. Shutemov wrote: >> [...] >>>> +static inline int head_mapcount(struct page *head) >>>> +{ >>> >>> Do we want VM_BUG_ON_PAGE(!PageHead(head), head) here? >> >> Well, no. That was the point of the bug report -- by the time we called >> compound_mapcount, the page was no longer a head page. > > Right. VM_BUG_ON_PAGE(PageTail(head), head)? Sorry for overlooking that feedback point. Looking at it now, I'd much rather not put any assertions at all here. This supposed to be for implementing the failure case, and we've moved past assertions at this point. In other words, dump_page() is part of *implementing* an assertion, so calling assertions from within it is undesirable. It's better to put the assertions in code that would call these inner routines. Then, if we want to use these routines outside of mm/debug.c, as per the other thread, then we should provide a wrapper that has such assertions. thanks, -- John Hubbard NVIDIA