linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: William Kucharski <william.kucharski@oracle.com>
To: Sean Christopherson <sean.j.christopherson@intel.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org,
	linux-mm@kvack.org, "Kirill A . Shutemov" <kirill@shutemov.name>,
	Martin Schwidefsky <schwidefsky@de.ibm.com>
Subject: Re: [PATCH] mm: warn only once if page table misaccounting is detected
Date: Tue, 27 Nov 2018 08:55:47 -0700	[thread overview]
Message-ID: <0AD1CE43-3B5B-4D4B-963B-056D749F196E@oracle.com> (raw)
In-Reply-To: <20181127155213.GB27075@linux.intel.com>



> On Nov 27, 2018, at 8:52 AM, Sean Christopherson <sean.j.christopherson@intel.com> wrote:
> 
> 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 <kirill@shutemov.name>
>> Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
>> Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
>> ---
>> 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?

Actually, I really like that idea.

There are certainly times when it is useful to see a cascade of messages, within reason;
one there are so many they overflow the dmesg buffer they're of limited usefulness.

Something like a pr_alert() that could rate limit to a preset value, perhaps a default of
fifty or so, could prove quite useful indeed without being an all or once choice.

    William Kucharski

      reply	other threads:[~2018-11-27 15:56 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-27  8:36 [PATCH] mm: warn only once if page table misaccounting is detected Heiko Carstens
2018-11-27  8:46 ` Kirill A. Shutemov
2018-11-27 13:19 ` Michal Hocko
2018-11-27 14:36   ` Heiko Carstens
2018-11-27 16:29     ` Michal Hocko
2018-11-27 15:52 ` Sean Christopherson
2018-11-27 15:55   ` William Kucharski [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0AD1CE43-3B5B-4D4B-963B-056D749F196E@oracle.com \
    --to=william.kucharski@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=heiko.carstens@de.ibm.com \
    --cc=kirill@shutemov.name \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=schwidefsky@de.ibm.com \
    --cc=sean.j.christopherson@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).