linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: David Rientjes <rientjes@google.com>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>,
	Guenter Roeck <linux@roeck-us.net>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	linux-mm@kvack.org, linux-bcache@vger.kernel.org,
	Vineet Gupta <vgupta@synopsys.com>,
	sparclinux@vger.kernel.org, linux-m68k@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm: Make {,set}page_address() static inline if WANT_PAGE_VIRTUAL
Date: Wed, 15 Jan 2014 15:02:14 -0800	[thread overview]
Message-ID: <20140115150214.d30aa6ab15b02c24b6923821@linux-foundation.org> (raw)
In-Reply-To: <alpine.DEB.2.02.1401151454440.24121@chino.kir.corp.google.com>

On Wed, 15 Jan 2014 14:57:56 -0800 (PST) David Rientjes <rientjes@google.com> wrote:

> On Wed, 15 Jan 2014, Geert Uytterhoeven wrote:
> 
> > {,set}page_address() are macros if WANT_PAGE_VIRTUAL.
> > If !WANT_PAGE_VIRTUAL, they're plain C functions.
> > 
> > If someone calls them with a void *, this pointer is auto-converted to
> > struct page * if !WANT_PAGE_VIRTUAL, but causes a build failure on
> > architectures using WANT_PAGE_VIRTUAL (arc, m68k and sparc):
> 
> s/sparc/sparc64/
> 
> > 
> > drivers/md/bcache/bset.c: In function _____btree_sort___:
> > drivers/md/bcache/bset.c:1190: warning: dereferencing ___void *___ pointer
> > drivers/md/bcache/bset.c:1190: error: request for member ___virtual___ in something not a structure or union
> > 
> > Convert them to static inline functions to fix this. There are already
> > plenty of  users of struct page members inside <linux/mm.h>, so there's no
> > reason to keep them as macros.
> > 
> > Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
> 
> Tested-by: David Rientjes <rientjes@google.com>
> 
> I'm cringing at the page_address(mempool_alloc(..., GFP_NOIO)) in 
> drivers/md/bcache/bset.c, though.

Yes, I was staring suspiciously at that as well.  Ended up deciding
that I wouldn't have coded it that way, but we should support the
casting.

>  It's relying on that fact that 
> mempool_alloc() can never return NULL if __GFP_WAIT but I think this could 
> have all been avoided with
> 
> 	struct page *page = mempool_alloc(state->pool, GFP_NOIO);
> 	out = page_address(page);
> 
> instead of burying the mempool_alloc() in page_address() for what I think 
> is cleaner code.  Owell, it fixes the issue.

And that would make the later virt_to_page() unnecessary.

--
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-01-15 23:02 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-15  9:33 Geert Uytterhoeven
2014-01-15  9:46 ` Michael S. Tsirkin
2014-01-15 10:31 ` Guenter Roeck
2014-01-15 22:57 ` David Rientjes
2014-01-15 23:02   ` Andrew Morton [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=20140115150214.d30aa6ab15b02c24b6923821@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=geert@linux-m68k.org \
    --cc=linux-bcache@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-m68k@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux@roeck-us.net \
    --cc=mst@redhat.com \
    --cc=rientjes@google.com \
    --cc=sparclinux@vger.kernel.org \
    --cc=vgupta@synopsys.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