All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mel Gorman <mel@csn.ul.ie>
To: Andi Kleen <andi@firstfloor.org>
Cc: Rik van Riel <riel@redhat.com>, Rafael Aquini <aquini@redhat.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	linux-kernel@vger.kernel.org,
	virtualization@lists.linux-foundation.org, linux-mm@kvack.org
Subject: Re: [PATCH 1/4] mm: introduce compaction and migration for virtio ballooned pages
Date: Tue, 26 Jun 2012 21:15:13 +0100	[thread overview]
Message-ID: <20120626201513.GJ8103__43387.3241454878$1340741731$gmane$org@csn.ul.ie> (raw)
In-Reply-To: <20120626165258.GY11413@one.firstfloor.org>

On Tue, Jun 26, 2012 at 06:52:58PM +0200, Andi Kleen wrote:
> > 
> > What shocked me actually is that VM_BUG_ON code is executed on
> > !CONFIG_DEBUG_VM builds and has been since 2.6.36 due to commit [4e60c86bd:
> > gcc-4.6: mm: fix unused but set warnings]. I thought the whole point of
> > VM_BUG_ON was to avoid expensive and usually unnecessary checks. Andi,
> > was this deliberate?
> 
> The idea was that the compiler optimizes it away anyways.
> 
> I'm not fully sure what putback_balloon_page does, but if it just tests
> a bit (without non variable test_bit) it should be ok.
> 

This was the definition before

#ifdef CONFIG_DEBUG_VM
#define VM_BUG_ON(cond) BUG_ON(cond)
#else
#define VM_BUG_ON(cond) do { } while (0)
#endif

and now it's

#ifdef CONFIG_DEBUG_VM
#define VM_BUG_ON(cond) BUG_ON(cond)
#else
#define VM_BUG_ON(cond) do { (void)(cond); } while (0)
#endif

How is the compiler meant to optimise away "cond" if it's a function
call?

In the old definition VM_BUG_ON did nothing and the intention was that the
"cond" should never had any side-effects. It was to be used for potentially
expensive tests to catch additional issues in DEBUG_VM kernels. My concern
is that after commit 4e60c86bd that the VM doing these additional checks
unnecesarily with a performance hit. In most cases the checks are small
but in others such as free_pages we are calling virt_addr_valid() which
is heavier.

What did I miss? If nothing, then I will revert this particular change
and Rafael will need to be sure his patch is not using VM_BUG_ON to call
a function with side-effects.

-- 
Mel Gorman
SUSE Labs

  parent reply	other threads:[~2012-06-26 20:15 UTC|newest]

Thread overview: 56+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-25 23:25 [PATCH 0/4] make balloon pages movable by compaction Rafael Aquini
2012-06-25 23:25 ` Rafael Aquini
2012-06-25 23:25 ` [PATCH 1/4] mm: introduce compaction and migration for virtio ballooned pages Rafael Aquini
2012-06-25 23:25 ` Rafael Aquini
2012-06-25 23:25   ` Rafael Aquini
2012-06-25 23:31   ` Konrad Rzeszutek Wilk
2012-06-25 23:31   ` Konrad Rzeszutek Wilk
2012-06-25 23:31     ` Konrad Rzeszutek Wilk
2012-06-25 23:57     ` Rafael Aquini
2012-06-25 23:57     ` Rafael Aquini
2012-06-25 23:57       ` Rafael Aquini
2012-06-26 10:17   ` Mel Gorman
2012-06-26 10:17     ` Mel Gorman
2012-06-26 16:52     ` Andi Kleen
2012-06-26 16:52       ` Andi Kleen
2012-06-26 16:54       ` Andi Kleen
2012-06-26 16:54         ` Andi Kleen
2012-06-26 16:54         ` Andi Kleen
2012-06-26 20:15       ` Mel Gorman
2012-06-26 20:15         ` Mel Gorman
2012-06-26 20:34         ` Andi Kleen
2012-06-26 20:34         ` Andi Kleen
2012-06-26 20:34           ` Andi Kleen
2012-06-27  9:42           ` Mel Gorman
2012-06-27  9:42           ` Mel Gorman
2012-06-27  9:42             ` Mel Gorman
2012-06-26 20:15       ` Mel Gorman [this message]
2012-06-26 16:52     ` Andi Kleen
2012-06-26 22:01     ` Rafael Aquini
2012-06-26 22:01       ` Rafael Aquini
2012-06-26 22:01       ` Rafael Aquini
2012-06-26 10:17   ` Mel Gorman
2012-06-26 13:17   ` Rik van Riel
2012-06-26 13:17     ` Rik van Riel
2012-06-26 13:17     ` Rik van Riel
2012-06-26 13:20     ` Mel Gorman
2012-06-26 13:20     ` Mel Gorman
2012-06-26 13:20       ` Mel Gorman
2012-06-26 23:57   ` Konrad Rzeszutek Wilk
2012-06-26 23:57     ` Konrad Rzeszutek Wilk
2012-06-27 15:17     ` Rafael Aquini
2012-06-27 15:17       ` Rafael Aquini
2012-06-27 15:30       ` Konrad Rzeszutek Wilk
2012-06-27 15:30         ` Konrad Rzeszutek Wilk
2012-06-27 15:30       ` Konrad Rzeszutek Wilk
2012-06-27 15:17     ` Rafael Aquini
2012-06-26 23:57   ` Konrad Rzeszutek Wilk
2012-06-25 23:25 ` [PATCH 2/4] virtio_balloon: handle concurrent accesses to virtio_balloon struct elements Rafael Aquini
2012-06-25 23:25 ` Rafael Aquini
2012-06-25 23:25   ` Rafael Aquini
2012-06-25 23:25 ` [PATCH 3/4] virtio_balloon: introduce migration primitives to balloon pages Rafael Aquini
2012-06-25 23:25   ` Rafael Aquini
2012-06-25 23:25 ` Rafael Aquini
2012-06-25 23:25 ` [PATCH 4/4] mm: add vm event counters for balloon pages compaction Rafael Aquini
2012-06-25 23:25   ` Rafael Aquini
2012-06-25 23:25 ` Rafael Aquini

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='20120626201513.GJ8103__43387.3241454878$1340741731$gmane$org@csn.ul.ie' \
    --to=mel@csn.ul.ie \
    --cc=andi@firstfloor.org \
    --cc=aquini@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mst@redhat.com \
    --cc=riel@redhat.com \
    --cc=virtualization@lists.linux-foundation.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.