On 15.10.19 11:21, Anshuman Khandual wrote:
alloc_gigantic_page() implements an allocation method where it scans over
various zones looking for a large contiguous memory block which could not
have been allocated through the buddy allocator. A subsequent patch which
tests arch page table helpers needs such a method to allocate PUD_SIZE
sized memory block. In the future such methods might have other use cases
as well. So alloc_gigantic_page() has been split carving out actual memory
allocation method and made available via new alloc_gigantic_page_order()
which is wrapped under CONFIG_CONTIG_ALLOC.

Cc: Andrew Morton <a...@linux-foundation.org>
Cc: Vlastimil Babka <vba...@suse.cz>
Cc: Greg Kroah-Hartman <gre...@linuxfoundation.org>
Cc: Thomas Gleixner <t...@linutronix.de>
Cc: Mike Rapoport <r...@linux.vnet.ibm.com>
Cc: Mike Kravetz <mike.krav...@oracle.com>
Cc: Jason Gunthorpe <j...@ziepe.ca>
Cc: Dan Williams <dan.j.willi...@intel.com>
Cc: Peter Zijlstra <pet...@infradead.org>
Cc: Michal Hocko <mho...@kernel.org>
Cc: Mark Rutland <mark.rutl...@arm.com>
Cc: Mark Brown <broo...@kernel.org>
Cc: Steven Price <steven.pr...@arm.com>
Cc: Ard Biesheuvel <ard.biesheu...@linaro.org>
Cc: Masahiro Yamada <yamada.masah...@socionext.com>
Cc: Kees Cook <keesc...@chromium.org>
Cc: Tetsuo Handa <penguin-ker...@i-love.sakura.ne.jp>
Cc: Matthew Wilcox <wi...@infradead.org>
Cc: Sri Krishna chowdary <schowd...@nvidia.com>
Cc: Dave Hansen <dave.han...@intel.com>
Cc: Russell King - ARM Linux <li...@armlinux.org.uk>
Cc: Michael Ellerman <m...@ellerman.id.au>
Cc: Paul Mackerras <pau...@samba.org>
Cc: Martin Schwidefsky <schwidef...@de.ibm.com>
Cc: Heiko Carstens <heiko.carst...@de.ibm.com>
Cc: "David S. Miller" <da...@davemloft.net>
Cc: Vineet Gupta <vgu...@synopsys.com>
Cc: James Hogan <jho...@kernel.org>
Cc: Paul Burton <paul.bur...@mips.com>
Cc: Ralf Baechle <r...@linux-mips.org>
Cc: Kirill A. Shutemov <kir...@shutemov.name>
Cc: Gerald Schaefer <gerald.schae...@de.ibm.com>
Cc: Christophe Leroy <christophe.le...@c-s.fr>
Cc: David Rientjes <rient...@google.com>
Cc: Andrea Arcangeli <aarca...@redhat.com>
Cc: Oscar Salvador <osalva...@suse.de>
Cc: Mel Gorman <mgor...@techsingularity.net>
Cc: linux-snps-arc@lists.infradead.org
Cc: linux-m...@vger.kernel.org
Cc: linux-arm-ker...@lists.infradead.org
Cc: linux-i...@vger.kernel.org
Cc: linuxppc-...@lists.ozlabs.org
Cc: linux-s...@vger.kernel.org
Cc: linux...@vger.kernel.org
Cc: sparcli...@vger.kernel.org
Cc: x...@kernel.org
Cc: linux-ker...@vger.kernel.org
Signed-off-by: Anshuman Khandual <anshuman.khand...@arm.com>
---
  include/linux/gfp.h |  3 ++
  mm/hugetlb.c        | 76 +----------------------------------
  mm/page_alloc.c     | 98 +++++++++++++++++++++++++++++++++++++++++++++
  3 files changed, 102 insertions(+), 75 deletions(-)

diff --git a/include/linux/gfp.h b/include/linux/gfp.h
index fb07b503dc45..379ad23437d1 100644
--- a/include/linux/gfp.h
+++ b/include/linux/gfp.h
@@ -589,6 +589,9 @@ static inline bool pm_suspended_storage(void)
  /* The below functions must be run on a range from a single zone. */
  extern int alloc_contig_range(unsigned long start, unsigned long end,
                              unsigned migratetype, gfp_t gfp_mask);
+extern struct page *alloc_gigantic_page_order(unsigned int order,
+                                             gfp_t gfp_mask, int nid,
+                                             nodemask_t *nodemask);
  #endif
  void free_contig_range(unsigned long pfn, unsigned int nr_pages);
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 977f9a323a7a..d199556a4a2c 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -1023,86 +1023,12 @@ static void free_gigantic_page(struct page *page, 
unsigned int order)
  }
#ifdef CONFIG_CONTIG_ALLOC
-static int __alloc_gigantic_page(unsigned long start_pfn,
-                               unsigned long nr_pages, gfp_t gfp_mask)
-{
-       unsigned long end_pfn = start_pfn + nr_pages;
-       return alloc_contig_range(start_pfn, end_pfn, MIGRATE_MOVABLE,
-                                 gfp_mask);
-}
-
-static bool pfn_range_valid_gigantic(struct zone *z,
-                       unsigned long start_pfn, unsigned long nr_pages)
-{
-       unsigned long i, end_pfn = start_pfn + nr_pages;
-       struct page *page;
-
-       for (i = start_pfn; i < end_pfn; i++) {
-               if (!pfn_valid(i))
-                       return false;
-
-               page = pfn_to_page(i);

Am I missing something or should here really be a pfn_to_online_page() here instead of a pfn_valid() ?


--

Thanks,

David / dhildenb

_______________________________________________
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc

Reply via email to