linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Toshi Kani <toshi.kani@hpe.com>
To: Dan Williams <dan.j.williams@intel.com>, akpm@linux-foundation.org
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm: fix 'size' alignment in devm_memremap_pages()
Date: Tue, 08 Mar 2016 18:16:31 -0700	[thread overview]
Message-ID: <1457486191.15454.532.camel@hpe.com> (raw)
In-Reply-To: <20160308222516.16008.22439.stgit@dwillia2-desk3.jf.intel.com>

On Tue, 2016-03-08 at 14:32 -0800, Dan Williams wrote:
> We need to align the end address, not just the size.
> 
> Cc: Toshi Kani <toshi.kani@hpe.com>
> Signed-off-by: Dan Williams <dan.j.williams@intel.com>

The change looks good.

Reviewed-by: Toshi Kani <toshi.kani@hpe.com>

Thanks,
-Toshi

> ---
> Hi Andrew, one more fixup to devm_memremap_pages().A A I was discussing
> patch "mm: fix mixed zone detection in devm_memremap_pages" with Toshi
> and noticed that it was mishandling the end-of-range alignment.A A Please
> apply or fold this into the existing patch.
> 
> A kernel/memremap.c |A A A 12 +++++++-----
> A 1 file changed, 7 insertions(+), 5 deletions(-)
> 
> diff --git a/kernel/memremap.c b/kernel/memremap.c
> index c0f11a498a5a..60baf4d3401e 100644
> --- a/kernel/memremap.c
> +++ b/kernel/memremap.c
> @@ -270,14 +270,16 @@ struct dev_pagemap
> *find_dev_pagemap(resource_size_t phys)
> A void *devm_memremap_pages(struct device *dev, struct resource *res,
> A 		struct percpu_ref *ref, struct vmem_altmap *altmap)
> A {
> -	resource_size_t align_start = res->start & ~(SECTION_SIZE - 1);
> -	resource_size_t align_size = ALIGN(resource_size(res),
> SECTION_SIZE);
> -	int is_ram = region_intersects(align_start, align_size, "System
> RAM");
> -	resource_size_t key, align_end;
> +	resource_size_t key, align_start, align_size, align_end;
> A 	struct dev_pagemap *pgmap;
> A 	struct page_map *page_map;
> +	int error, nid, is_ram;
> A 	unsigned long pfn;
> -	int error, nid;
> +
> +	align_start = res->start & ~(SECTION_SIZE - 1);
> +	align_size = ALIGN(res->start + resource_size(res),
> SECTION_SIZE)
> +		- align_start;
> +	is_ram = region_intersects(align_start, align_size, "System
> RAM");
> A 
> A 	if (is_ram == REGION_MIXED) {
> A 		WARN_ONCE(1, "%s attempted on mixed region %pr\n",
> 

--
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:[~2016-03-09  0:23 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-08 22:32 [PATCH] mm: fix 'size' alignment in devm_memremap_pages() Dan Williams
2016-03-09  1:16 ` Toshi Kani [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=1457486191.15454.532.camel@hpe.com \
    --to=toshi.kani@hpe.com \
    --cc=akpm@linux-foundation.org \
    --cc=dan.j.williams@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.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).