All of lore.kernel.org
 help / color / mirror / Atom feed
* Make  __memblock_free_early a wrapper of memblock_free rather dup it
@ 2018-11-22  4:01 Wang, Matt
  2018-11-22  5:27 ` Andrew Morton
  0 siblings, 1 reply; 5+ messages in thread
From: Wang, Matt @ 2018-11-22  4:01 UTC (permalink / raw)
  To: akpm; +Cc: linux-mm


[-- Attachment #1.1: Type: text/plain, Size: 1452 bytes --]

Hi Andrew,

I noticed that __memblock_free_early and memblock_free has the same code. At first I think we can delete __memblock_free_early till __memblock_free_late remind me __memblock_free_early is meaningful. It's a note to call this before struct page was initialized.

So I choose to make __memblock_free_early a wrapper of memblock_free. Here is the patch (see attachment file):

>From 5f21fb0409e91b42373832627e44cd0a8275c820 Mon Sep 17 00:00:00 2001
From: Wentao Wang <witallwang@gmail.com>
Date: Thu, 22 Nov 2018 11:35:59 +0800
Subject: [PATCH] Make __memblock_free_early a wrapper of memblock_free rather
than dup it

Signed-off-by: Wentao Wang <witallwang@gmail.com>
---
mm/memblock.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/mm/memblock.c b/mm/memblock.c
index 9a2d5ae..08bf136 100644
--- a/mm/memblock.c
+++ b/mm/memblock.c
@@ -1546,12 +1546,7 @@ void * __init memblock_alloc_try_nid(
  */
void __init __memblock_free_early(phys_addr_t base, phys_addr_t size)
{
-       phys_addr_t end = base + size - 1;
-
-       memblock_dbg("%s: [%pa-%pa] %pF\n",
-                    __func__, &base, &end, (void *)_RET_IP_);
-       kmemleak_free_part_phys(base, size);
-       memblock_remove_range(&memblock.reserved, base, size);
+       memblock_free(base, size);
}

/**
--
1.8.3.1

Testing:
Build with memblock, system bootup normally and works well.

Regards,
Wentao


[-- Attachment #1.2: Type: text/html, Size: 5178 bytes --]

[-- Attachment #2: 0001-Make-__memblock_free_early-a-wrapper-of-memblock_fre.patch --]
[-- Type: application/octet-stream, Size: 900 bytes --]

From 5f21fb0409e91b42373832627e44cd0a8275c820 Mon Sep 17 00:00:00 2001
From: Wentao Wang <witallwang@gmail.com>
Date: Thu, 22 Nov 2018 11:35:59 +0800
Subject: [PATCH] Make __memblock_free_early a wrapper of memblock_free rather
 than dup it

Signed-off-by: Wentao Wang <witallwang@gmail.com>
---
 mm/memblock.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/mm/memblock.c b/mm/memblock.c
index 9a2d5ae..08bf136 100644
--- a/mm/memblock.c
+++ b/mm/memblock.c
@@ -1546,12 +1546,7 @@ void * __init memblock_alloc_try_nid(
  */
 void __init __memblock_free_early(phys_addr_t base, phys_addr_t size)
 {
-	phys_addr_t end = base + size - 1;
-
-	memblock_dbg("%s: [%pa-%pa] %pF\n",
-		     __func__, &base, &end, (void *)_RET_IP_);
-	kmemleak_free_part_phys(base, size);
-	memblock_remove_range(&memblock.reserved, base, size);
+	memblock_free(base, size);
 }
 
 /**
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-11-26  7:13 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-22  4:01 Make __memblock_free_early a wrapper of memblock_free rather dup it Wang, Matt
2018-11-22  5:27 ` Andrew Morton
2018-11-25 10:29   ` Mike Rapoport
2018-11-26  2:25     ` Wang, Matt
2018-11-26  7:13       ` Mike Rapoport

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.