linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Dave Jones <davej@redhat.com>
To: Michal Hocko <mhocko@suse.cz>
Cc: Linux Kernel <linux-kernel@vger.kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-mm@kvack.org, Sasha Levin <sasha.levin@oracle.com>
Subject: Re: [PATCH] mm, debug: mm-introduce-vm_bug_on_mm-fix-fix.patch
Date: Tue, 14 Oct 2014 12:50:27 -0400	[thread overview]
Message-ID: <20141014165027.GA26886@redhat.com> (raw)
In-Reply-To: <20141014115554.GB8727@dhcp22.suse.cz>

On Tue, Oct 14, 2014 at 01:55:54PM +0200, Michal Hocko wrote:

 > > -#ifdef CONFIG_NUMA_BALANCING
 > > -		"numa_next_scan %lu numa_scan_offset %lu numa_scan_seq %d\n"
 > > -#endif
 > > -#if defined(CONFIG_NUMA_BALANCING) || defined(CONFIG_COMPACTION)
 > > -		"tlb_flush_pending %d\n"
 > > -#endif
 > > -		"%s",	/* This is here to hold the comma */
 > > +	char *p = dumpmm_buffer;
 > > +
 > > +	memset(dumpmm_buffer, 0, 4096);
 > 
 > I do not see any locking here. Previously we had internal printk log as
 > a natural synchronization. Now two threads are allowed to scribble over
 > their messages leaving an unusable output in a better case.

That's why I asked in the part of the mail you didn't quote whether
we cared if it wasn't reentrant.  Ok we do. That's 3 lines of change to
add a lock.

 > Besides that the %s with "" trick is not really that ugly and handles
 > the situation quite nicely. So do we really want to make it more
 > complicated?

That hack goes away entirely with this diff.  And by keeping the
parameters with the format string they're associated with, it should be
more maintainable should we decide to add more fields to be output in the future.
The number of ifdefs in the function are halved (which becomes even
bigger deal if we do add more output).

We saw how many times we had to go around to get it right this time.
In its current incarnation, it looks like a matter of time before
someone screws it up again due to missing some CONFIG combination.

	Dave

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2014-10-14 16:50 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-23  0:02 mmotm 2014-09-22-16-57 uploaded akpm
2014-09-23  0:39 ` Stephen Rothwell
2014-09-23  1:12   ` Andrew Morton
2014-09-23  9:24 ` [PATCH] mm, debug: mm-introduce-vm_bug_on_mm-fix.patch Michal Hocko
2014-09-23 11:28   ` [PATCH] mm, debug: mm-introduce-vm_bug_on_mm-fix-fix.patch Michal Hocko
2014-09-23 16:19     ` Valdis.Kletnieks
2014-09-23 20:52       ` Andrew Morton
2014-09-24  7:09         ` Michal Hocko
2014-09-23 20:12     ` Dave Jones
2014-10-13 18:51       ` Dave Jones
2014-10-13 19:07         ` Joe Perches
2014-10-14 11:55         ` Michal Hocko
2014-10-14 16:50           ` Dave Jones [this message]
2014-10-15  9:03             ` Michal Hocko
2014-09-23 19:02 ` mmotm 2014-09-22-16-57 uploaded Guenter Roeck
2014-09-23 20:01   ` Andrew Morton
2014-09-23 20:13     ` Fabio Estevam
2014-09-23 20:20     ` Naoya Horiguchi
2014-09-23 20:38     ` Guenter Roeck
2014-09-23 21:08       ` Anish Bhatt
2014-09-23 20:31   ` Randy Dunlap
2014-09-23 20:57     ` Guenter Roeck
2014-09-23 21:36       ` Randy Dunlap
2014-09-23 21:53         ` Guenter Roeck
2014-09-24  4:34           ` Guenter Roeck
2014-09-24  6:24             ` David Miller
2014-09-24  7:18             ` Geert Uytterhoeven

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=20141014165027.GA26886@redhat.com \
    --to=davej@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.cz \
    --cc=sasha.levin@oracle.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).