public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: Stephen Boyd <sboyd@quicinc.com>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Yinghai Lu <yinghai@kernel.org>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>
Subject: Re: memblock_is_region_memory() vs. memblock_is_region_reserved()
Date: Tue, 15 May 2012 08:15:09 -0700	[thread overview]
Message-ID: <20120515151509.GC6119@google.com> (raw)
In-Reply-To: <4FB1AD38.7000503@quicinc.com>

On Mon, May 14, 2012 at 06:11:20PM -0700, Stephen Boyd wrote:
> I was looking at memblock and noticed that memblock_is_region_memory()
> is implemented differently than memblock_is_region_reserved().
> 
> memblock_is_region_memory() returns true only if the region you are
> testing is fully contained within the bounds of a memory block. If the
> region is half in and half out of a memory region (i.e. overlaps memory
> and a hole) it is not memory and returns false.
> 
> memblock_is_region_reserved() is the opposite. If the region are you are
> testing is half in and half out of a reserved region (i.e. overlaps
> reserved memory) it returns true, otherwise it returns false.
> 
> These functions sound like they do the same thing by testing to see if
> what you specify is either memory or reserved memory, but the semantics
> are a bit different in that the former doesn't allow overlap, and the
> latter accepts overlap. Should we rename memblock_is_region_reserved()
> to memblock_overlaps_reserved() to make it clearer what the intention
> is? Or perhaps rename memblock_is_region_memory() to
> memblock_is_region_within_memory()?

The difference is there because for a memory region to be available,
all of it should be while a memory region partially reserved should
still be treated as reserved.

> If anything, perhaps this patch will help clarify things?

Yeah, looks good to me.  Can you please add patch description,
sign-off and send it to Ingo?

Thanks.

-- 
tejun

  reply	other threads:[~2012-05-15 15:15 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-15  1:11 memblock_is_region_memory() vs. memblock_is_region_reserved() Stephen Boyd
2012-05-15 15:15 ` Tejun Heo [this message]
2012-05-24  7:45   ` [PATCH] memblock: Document memblock_is_region_{memory,reserved}() Stephen Boyd
2012-06-07 17:23     ` Stephen Boyd
2012-06-08 14:54     ` [tip:core/urgent] memblock: Document memblock_is_region_{memory, reserved}() tip-bot for Stephen Boyd

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=20120515151509.GC6119@google.com \
    --to=tj@kernel.org \
    --cc=benh@kernel.crashing.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sboyd@quicinc.com \
    --cc=yinghai@kernel.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