Re: [PATCH 2/4] mm/memblock: introduce memblock_search_pfn_regions()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Daniel

Thanks for the review


On 3/21/2018 6:14 PM, Daniel Vacek Wrote:
On Wed, Mar 21, 2018 at 9:09 AM, Jia He <hejianet@xxxxxxxxx> wrote:
This api is the preparation for further optimizing early_pfn_valid

Signed-off-by: Jia He <jia.he@xxxxxxxxxxxxxxxx>
---
  include/linux/memblock.h |  2 ++
  mm/memblock.c            | 12 ++++++++++++
  2 files changed, 14 insertions(+)

diff --git a/include/linux/memblock.h b/include/linux/memblock.h
index 9471db4..5f46956 100644
--- a/include/linux/memblock.h
+++ b/include/linux/memblock.h
@@ -203,6 +203,8 @@ void __next_mem_pfn_range(int *idx, int nid, unsigned long *out_start_pfn,
              i >= 0; __next_mem_pfn_range(&i, nid, p_start, p_end, p_nid))
  #endif /* CONFIG_HAVE_MEMBLOCK_NODE_MAP */

+int memblock_search_pfn_regions(unsigned long pfn);
+
  unsigned long memblock_next_valid_pfn(unsigned long pfn, int *last_idx);
  /**
   * for_each_free_mem_range - iterate through free memblock areas
diff --git a/mm/memblock.c b/mm/memblock.c
index a9e8da4..f50fe5b 100644
--- a/mm/memblock.c
+++ b/mm/memblock.c
@@ -1659,6 +1659,18 @@ static int __init_memblock memblock_search(struct memblock_type *type, phys_addr
         return -1;
  }

+/* search memblock with the input pfn, return the region idx */
+int __init_memblock memblock_search_pfn_regions(unsigned long pfn)
+{
+       struct memblock_type *type = &memblock.memory;
+       int mid = memblock_search(type, PFN_PHYS(pfn));
+
+       if (mid == -1)
+               return -1;
Why this?
Yes, it is redudant and can be removed.
Thanks

Cheers,
Jia




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux