From: Akinobu Mita <akinobu.mita@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: Akinobu Mita <akinobu.mita@gmail.com>,
Sabrina Dubroca <sd@queasysnail.net>,
linux-mm@kvack.org
Subject: [PATCH v2 1/3] mm: use memblock_alloc_range_nid() and memblock_alloc_range()
Date: Tue, 9 Sep 2014 08:38:02 +0900 [thread overview]
Message-ID: <1410219484-8038-1-git-send-email-akinobu.mita@gmail.com> (raw)
memblock_alloc_range_nid() is equivalent to memblock_find_in_range_node()
followed by memblock_reserve(). memblock_alloc_range() is equivalent to
memblock_alloc_range_nid() with NUMA_NO_NODE for any node.
Convert to use these functions and remove subsequent kmemleak_alloc()
call as it is already called in memblock_alloc() and its variants.
This is just a cleanup.
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: Sabrina Dubroca <sd@queasysnail.net>
Cc: linux-mm@kvack.org
---
* v2: fix overlapping kmemleak_alloc() calls, reported by Sabrina Dubroca.
mm/memblock.c | 18 ++----------------
1 file changed, 2 insertions(+), 16 deletions(-)
diff --git a/mm/memblock.c b/mm/memblock.c
index 70fad0c..a942f6e 100644
--- a/mm/memblock.c
+++ b/mm/memblock.c
@@ -1150,21 +1150,16 @@ static void * __init memblock_virt_alloc_internal(
if (WARN_ON_ONCE(slab_is_available()))
return kzalloc_node(size, GFP_NOWAIT, nid);
- if (!align)
- align = SMP_CACHE_BYTES;
-
if (max_addr > memblock.current_limit)
max_addr = memblock.current_limit;
again:
- alloc = memblock_find_in_range_node(size, align, min_addr, max_addr,
- nid);
+ alloc = memblock_alloc_range_nid(size, align, min_addr, max_addr, nid);
if (alloc)
goto done;
if (nid != NUMA_NO_NODE) {
- alloc = memblock_find_in_range_node(size, align, min_addr,
- max_addr, NUMA_NO_NODE);
+ alloc = memblock_alloc_range(size, align, min_addr, max_addr);
if (alloc)
goto done;
}
@@ -1177,18 +1172,9 @@ again:
}
done:
- memblock_reserve(alloc, size);
ptr = phys_to_virt(alloc);
memset(ptr, 0, size);
- /*
- * The min_count is set to 0 so that bootmem allocated blocks
- * are never reported as leaks. This is because many of these blocks
- * are only referred via the physical address which is not
- * looked up by kmemleak.
- */
- kmemleak_alloc(ptr, size, 0, 0);
-
return ptr;
error:
--
1.9.1
--
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>
next reply other threads:[~2014-09-08 23:38 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-08 23:38 Akinobu Mita [this message]
2014-09-08 23:38 ` [PATCH v2 2/3] x86: use memblock_alloc_range() Akinobu Mita
2014-09-08 23:38 ` [PATCH v2 3/3] x86: use __memblock_alloc_base() and memblock_alloc_base() Akinobu Mita
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=1410219484-8038-1-git-send-email-akinobu.mita@gmail.com \
--to=akinobu.mita@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=sd@queasysnail.net \
/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).