Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2601133pxa; Fri, 7 Aug 2020 15:41:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzh4gjre0f39a6jz/4tU7xJOhbfdIqYIyWsgB1GAMG4xKIM2ozmc4fCcY0L5xNXqNpGCRaf X-Received: by 2002:a17:906:d9db:: with SMTP id qk27mr11293696ejb.37.1596840107957; Fri, 07 Aug 2020 15:41:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596840107; cv=none; d=google.com; s=arc-20160816; b=mQsvN0eMiYF15zT5JnUhGJn+HA6QE1vjeny4TP+7YBMzfeQmAZSHPDDRqzOQnlqTJw Uok6uqUPdbjy/84FO1t6FfqF0c3zbpcp6kPsUbuBnIbLG+r3QBzESJZXF6O9W73A4IsU VfRN2bRlVg0Hs664Qy1/SkZQnhSRzg1UnUnCXRK0FtQxj7KGWcAPBo94uE6K1IttHRRW ThFNa2ZMv4SaWTjW1DIlm8GLKiOJ1P9+yYaAekiE5e6Z6+5ospMOYYSxpSds+J7KBDtH q76Rd9iY61l++WaYZDFZ+75RbWznwFo+a54v8Tvyo8CHj1JlO6Rx78qKt9udiJPSB8G4 yeDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:dkim-signature:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=V8KL8V1OqjlOYNcn5ZdslPutD+BA8Q66zxQ3bPAosTs=; b=JgCR2vFvm7ilevfMSv8HpC7t1ep2LYrF04mMx0Ligoao+XdiNI+bUIPQBriAd0u11X VaVJhXuIniXtNisrRAJ1Ko6ALstshK3wT1Wu/NSMz5QMbNZf+MTsyt3FydBjyToZlFtW tEHppHMmN6pTiQsyQq7wfnFLhRew6BFWjtGSrUIWiWBnSOJotQlA3S/R6U5iSrSTJ5xw E8TMnQ5bbvuyj6fI+j7m4gDnC4RupcUiLCt/pWs02TEHmTS9d/uDAb+iZ6lN6oBju9HE ADcqqZcEw2nh6SXTdIsfHaKKJK1rBYRXdbHe0ynQNhthrWWM7YjUxuUots2iNQmgWTDn MHkA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=YAApT+8M; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cb1si5753828edb.88.2020.08.07.15.41.12; Fri, 07 Aug 2020 15:41:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=YAApT+8M; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726131AbgHGWk3 (ORCPT + 99 others); Fri, 7 Aug 2020 18:40:29 -0400 Received: from hqnvemgate24.nvidia.com ([216.228.121.143]:8591 "EHLO hqnvemgate24.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726045AbgHGWk1 (ORCPT ); Fri, 7 Aug 2020 18:40:27 -0400 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== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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