Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp225475imu; Tue, 27 Nov 2018 11:25:32 -0800 (PST) X-Google-Smtp-Source: AFSGD/V8TMmjB4gUTH16m1LcdRfm+2DVsjRIyKspxaroUToX6TxFDAl2PDTSC9MR+sy9jZZ/w122 X-Received: by 2002:a17:902:6ac3:: with SMTP id i3-v6mr33834346plt.153.1543346732559; Tue, 27 Nov 2018 11:25:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543346732; cv=none; d=google.com; s=arc-20160816; b=vi260MA6YPQZgvSxHykf63by7ayptQJC/o/WgJjTSyfyU5ssi7jqVvnnn2oF4cgg15 rc37e6s38fPL/ALCPaJs4AGXgY7R6JVjd174TzdV+RwWvZ3HqwvKwESbd5eRs1hvEoXy uLoRLQA8oCWmvAKa4lWIlwMYAVXV3slJy7wpZJSzO8FNMdMhRiSwXH8ZnFFBM/2dYUyY s3ma9GKMvJf0m3Cz9HBr+WgAxfL7iNzB51GSAy/SlPFGNefmyJoOQtRXCi6uE8zPbjA5 kKlnMEaLEbzXAWtdO0HoZBMmKfmL6erxo2nPUET3JMJ0nIw2YOtUzly06Am4tpXEPddD ZDJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=sSsbRO8i4rnnUd7SaVyAdVeHzeNH/8RybLqdPVh1tXc=; b=aZdLAolBEjeB+Om4DUNl1+PiIEr7JOhtsRMzdggOraBxTvF5ewXCNh7+xCidaIyEGi CdeW8Gn9Nk4GJ2oDoNBU6edhy+RnuvGxsoRphgAvJaLkPCX81CqUbJqKGhX8P+tbrMFy KXIZvA0fd3FWBt+lbbF/+FTkTbEu2T7wQoA8hqqQdUY6YeaWRVBO8IhsA4dn06LStQBz eQKomYrEDeBxcQWeZYCaIRExunYKGF4Rfss+4CRsZbbeTBk8O6oHnJ10llO690pi2ldI QUkxfX+fkqpT7twLfO4HjQwE/JhQoLQFSmOU2WAhL8XOlMBHU59SYc/ZiZyl19a/ZyWC zu5Q== 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=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o7si4765518pgl.42.2018.11.27.11.25.17; Tue, 27 Nov 2018 11:25:32 -0800 (PST) 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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730236AbeK1Cud (ORCPT + 99 others); Tue, 27 Nov 2018 21:50:33 -0500 Received: from mga11.intel.com ([192.55.52.93]:56624 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729553AbeK1Cud (ORCPT ); Tue, 27 Nov 2018 21:50:33 -0500 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 27 Nov 2018 07:52:13 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,287,1539673200"; d="scan'208";a="93733830" Received: from sjchrist-coffee.jf.intel.com (HELO linux.intel.com) ([10.54.74.154]) by fmsmga008.fm.intel.com with ESMTP; 27 Nov 2018 07:52:13 -0800 Date: Tue, 27 Nov 2018 07:52:13 -0800 From: Sean Christopherson To: Heiko Carstens Cc: Andrew Morton , linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org, linux-mm@kvack.org, "Kirill A . Shutemov" , Martin Schwidefsky Subject: Re: [PATCH] mm: warn only once if page table misaccounting is detected Message-ID: <20181127155213.GB27075@linux.intel.com> References: <20181127083603.39041-1-heiko.carstens@de.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181127083603.39041-1-heiko.carstens@de.ibm.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Nov 27, 2018 at 09:36:03AM +0100, Heiko Carstens wrote: > Use pr_alert_once() instead of pr_alert() if page table misaccounting > has been detected. > > If this happens once it is very likely that there will be numerous > other occurrence as well, which would flood dmesg and the console with > hardly any added information. Therefore print the warning only once. > > Cc: Kirill A. Shutemov > Cc: Martin Schwidefsky > Signed-off-by: Heiko Carstens > --- > kernel/fork.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/kernel/fork.c b/kernel/fork.c > index 07cddff89c7b..c887e9eba89f 100644 > --- a/kernel/fork.c > +++ b/kernel/fork.c > @@ -647,8 +647,8 @@ static void check_mm(struct mm_struct *mm) > } > > if (mm_pgtables_bytes(mm)) > - pr_alert("BUG: non-zero pgtables_bytes on freeing mm: %ld\n", > - mm_pgtables_bytes(mm)); > + pr_alert_once("BUG: non-zero pgtables_bytes on freeing mm: %ld\n", > + mm_pgtables_bytes(mm)); I found the print-always behavior to be useful when developing a driver that mucked with PTEs directly via vmf_insert_pfn() and had issues with racing against exit_mmap(). It was nice to be able to recompile only the driver and rely on dmesg to let me know when I messed up yet again. Would pr_alert_ratelimited() suffice? > #if defined(CONFIG_TRANSPARENT_HUGEPAGE) && !USE_SPLIT_PMD_PTLOCKS > VM_BUG_ON_MM(mm->pmd_huge_pte, mm); > -- > 2.16.4 >