linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: linux@arm.linux.org.uk (Russell King - ARM Linux)
To: linux-arm-kernel@lists.infradead.org
Subject: memblock glitch
Date: Wed, 4 Aug 2010 09:54:47 +0100	[thread overview]
Message-ID: <20100804085447.GB4927@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <1280885890.1902.134.camel@pasglop>

On Wed, Aug 04, 2010 at 11:38:10AM +1000, Benjamin Herrenschmidt wrote:
> In arch/arm/plat-omap/fb.c:
> 
> static int valid_sdram(unsigned long addr, unsigned long size)
> {
> 	struct memblock_region res;
> 
> 	res.base = addr;
> 	res.size = size;
> 	return !memblock_find(&res) && res.base == addr && res.size == size;
> }
> 
> So if I understand things correctly, you are working around the weird
> behaviour of memblock_find(), which returns the intersection of the
> region passed and the first memblock that partially overlaps it.

Correct - what it's trying to ascertain is whether the address range
is entirely contained within a valid region.

> Since you are now the only user of that function (I was about to remove it),
> would you be happy if I replaced the above and the !SPARSEMEM pfn_valid()
> with a single function: memblock_is_mem(addr, size) ?
> 
> It can do a fast search (binary search or whatever) on addr, and then
> dbl check size (which would be PAGE_SIZE for pfn_valid).

You could do, but do we want to introduce size checks for pfn_valid?
I'm slightly concerned because it can be a hot path.

If all entries in memblock are already page aligned, if addr falls
within a memblock, it must cover the entire page so checking the size
seems redundant for this case.

  parent reply	other threads:[~2010-08-04  8:54 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-04  0:38 memblock glitch Benjamin Herrenschmidt
2010-08-04  1:38 ` Benjamin Herrenschmidt
2010-08-04  4:02   ` memblock_is_region_reserved() issue Benjamin Herrenschmidt
2010-09-02 13:41     ` Russell King - ARM Linux
2010-08-04  8:54   ` Russell King - ARM Linux [this message]
2010-08-04 10:41     ` memblock glitch Benjamin Herrenschmidt
2010-08-04  8:49 ` Russell King - ARM Linux

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=20100804085447.GB4927@n2100.arm.linux.org.uk \
    --to=linux@arm.linux.org.uk \
    --cc=linux-arm-kernel@lists.infradead.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 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).