diff mbox series

[10/16] mm: remove obsolete alloc_remap()

Message ID 20180314143958.1548568-1-arnd@arndb.de
State Accepted
Commit 79375ea3ec527f746d5beae8c8f6e8a58740d4a8
Headers show
Series [01/16] mn10300: Remove the architecture | expand

Commit Message

Arnd Bergmann March 14, 2018, 2:39 p.m. UTC
Tile was the only remaining architecture to implement alloc_remap(),
and since that is being removed, there is no point in keeping this
function.

Removing all callers simplifies the mem_map handling.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>

---
 include/linux/bootmem.h |  9 ---------
 mm/page_alloc.c         |  5 +----
 mm/sparse.c             | 15 ---------------
 3 files changed, 1 insertion(+), 28 deletions(-)

-- 
2.9.0

Comments

Pavel Tatashin March 14, 2018, 2:50 p.m. UTC | #1
Hi Arnd,

I like this cleanup, but arch/tile (which is afaik Orphaned but still in the gate) has:

HAVE_ARCH_ALLOC_REMAP set to yes:

arch/tile/Kconfig
 config HAVE_ARCH_ALLOC_REMAP
         def_bool y

Define in arch/tile/kernel/setup.c:
void *__init alloc_remap(int nid, unsigned long size)
{
        int pages = node_end_pfn[nid] - node_start_pfn[nid];
        void *map = pfn_to_kaddr(node_memmap_pfn[nid]);
        BUG_ON(size != pages * sizeof(struct page));
        memset(map, 0, size);
        return map; 
}

Thank you,
Pavel

On 03/14/2018 10:39 AM, Arnd Bergmann wrote:
> Tile was the only remaining architecture to implement alloc_remap(),

> and since that is being removed, there is no point in keeping this

> function.

> 

> Removing all callers simplifies the mem_map handling.

> 

> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

> ---

>  include/linux/bootmem.h |  9 ---------

>  mm/page_alloc.c         |  5 +----

>  mm/sparse.c             | 15 ---------------

>  3 files changed, 1 insertion(+), 28 deletions(-)

> 

> diff --git a/include/linux/bootmem.h b/include/linux/bootmem.h

> index a53063e9d7d8..7942a96b1a9d 100644

> --- a/include/linux/bootmem.h

> +++ b/include/linux/bootmem.h

> @@ -364,15 +364,6 @@ static inline void __init memblock_free_late(

>  }

>  #endif /* defined(CONFIG_HAVE_MEMBLOCK) && defined(CONFIG_NO_BOOTMEM) */

>  

> -#ifdef CONFIG_HAVE_ARCH_ALLOC_REMAP

> -extern void *alloc_remap(int nid, unsigned long size);

> -#else

> -static inline void *alloc_remap(int nid, unsigned long size)

> -{

> -	return NULL;

> -}

> -#endif /* CONFIG_HAVE_ARCH_ALLOC_REMAP */

> -

>  extern void *alloc_large_system_hash(const char *tablename,

>  				     unsigned long bucketsize,

>  				     unsigned long numentries,

> diff --git a/mm/page_alloc.c b/mm/page_alloc.c

> index cb416723538f..484e21062228 100644

> --- a/mm/page_alloc.c

> +++ b/mm/page_alloc.c

> @@ -6199,10 +6199,7 @@ static void __ref alloc_node_mem_map(struct pglist_data *pgdat)

>  		end = pgdat_end_pfn(pgdat);

>  		end = ALIGN(end, MAX_ORDER_NR_PAGES);

>  		size =  (end - start) * sizeof(struct page);

> -		map = alloc_remap(pgdat->node_id, size);

> -		if (!map)

> -			map = memblock_virt_alloc_node_nopanic(size,

> -							       pgdat->node_id);

> +		map = memblock_virt_alloc_node_nopanic(size, pgdat->node_id);

>  		pgdat->node_mem_map = map + offset;

>  	}

>  	pr_debug("%s: node %d, pgdat %08lx, node_mem_map %08lx\n",

> diff --git a/mm/sparse.c b/mm/sparse.c

> index 7af5e7a92528..65bb52599f90 100644

> --- a/mm/sparse.c

> +++ b/mm/sparse.c

> @@ -427,10 +427,6 @@ struct page __init *sparse_mem_map_populate(unsigned long pnum, int nid,

>  	struct page *map;

>  	unsigned long size;

>  

> -	map = alloc_remap(nid, sizeof(struct page) * PAGES_PER_SECTION);

> -	if (map)

> -		return map;

> -

>  	size = PAGE_ALIGN(sizeof(struct page) * PAGES_PER_SECTION);

>  	map = memblock_virt_alloc_try_nid(size,

>  					  PAGE_SIZE, __pa(MAX_DMA_ADDRESS),

> @@ -446,17 +442,6 @@ void __init sparse_mem_maps_populate_node(struct page **map_map,

>  	unsigned long pnum;

>  	unsigned long size = sizeof(struct page) * PAGES_PER_SECTION;

>  

> -	map = alloc_remap(nodeid, size * map_count);

> -	if (map) {

> -		for (pnum = pnum_begin; pnum < pnum_end; pnum++) {

> -			if (!present_section_nr(pnum))

> -				continue;

> -			map_map[pnum] = map;

> -			map += size;

> -		}

> -		return;

> -	}

> -

>  	size = PAGE_ALIGN(size);

>  	map = memblock_virt_alloc_try_nid_raw(size * map_count,

>  					      PAGE_SIZE, __pa(MAX_DMA_ADDRESS),

>
Arnd Bergmann March 14, 2018, 2:56 p.m. UTC | #2
On Wed, Mar 14, 2018 at 3:50 PM, Pavel Tatashin
<pasha.tatashin@oracle.com> wrote:
> Hi Arnd,

>

> I like this cleanup, but arch/tile (which is afaik Orphaned but still in the gate) has:

>

> HAVE_ARCH_ALLOC_REMAP set to yes:

>

> arch/tile/Kconfig

>  config HAVE_ARCH_ALLOC_REMAP

>          def_bool y


It was a bit tricky to juggle the Cc lists here, but tile is removed
in patch 06/10
now. As I explained in the cover letter, it was originally planned to be marked
deprecated for a while first, but after some more discussion, nobody could come
up with a reason to keep it any longer. Same thing for mn10300,
blackfin and cris.

     Arnd
Pavel Tatashin March 14, 2018, 2:59 p.m. UTC | #3
On 03/14/2018 10:56 AM, Arnd Bergmann wrote:
> On Wed, Mar 14, 2018 at 3:50 PM, Pavel Tatashin

> <pasha.tatashin@oracle.com> wrote:

>> Hi Arnd,

>>

>> I like this cleanup, but arch/tile (which is afaik Orphaned but still in the gate) has:

>>

>> HAVE_ARCH_ALLOC_REMAP set to yes:

>>

>> arch/tile/Kconfig

>>  config HAVE_ARCH_ALLOC_REMAP

>>          def_bool y

> 

> It was a bit tricky to juggle the Cc lists here, but tile is removed

> in patch 06/10

> now. As I explained in the cover letter, it was originally planned to be marked

> deprecated for a while first, but after some more discussion, nobody could come

> up with a reason to keep it any longer. Same thing for mn10300,

> blackfin and cris.

> 


I see, thank you:

Reviewed-by: Pavel Tatashin <pasha.tatashin@oracle.com>
diff mbox series

Patch

diff --git a/include/linux/bootmem.h b/include/linux/bootmem.h
index a53063e9d7d8..7942a96b1a9d 100644
--- a/include/linux/bootmem.h
+++ b/include/linux/bootmem.h
@@ -364,15 +364,6 @@  static inline void __init memblock_free_late(
 }
 #endif /* defined(CONFIG_HAVE_MEMBLOCK) && defined(CONFIG_NO_BOOTMEM) */
 
-#ifdef CONFIG_HAVE_ARCH_ALLOC_REMAP
-extern void *alloc_remap(int nid, unsigned long size);
-#else
-static inline void *alloc_remap(int nid, unsigned long size)
-{
-	return NULL;
-}
-#endif /* CONFIG_HAVE_ARCH_ALLOC_REMAP */
-
 extern void *alloc_large_system_hash(const char *tablename,
 				     unsigned long bucketsize,
 				     unsigned long numentries,
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index cb416723538f..484e21062228 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -6199,10 +6199,7 @@  static void __ref alloc_node_mem_map(struct pglist_data *pgdat)
 		end = pgdat_end_pfn(pgdat);
 		end = ALIGN(end, MAX_ORDER_NR_PAGES);
 		size =  (end - start) * sizeof(struct page);
-		map = alloc_remap(pgdat->node_id, size);
-		if (!map)
-			map = memblock_virt_alloc_node_nopanic(size,
-							       pgdat->node_id);
+		map = memblock_virt_alloc_node_nopanic(size, pgdat->node_id);
 		pgdat->node_mem_map = map + offset;
 	}
 	pr_debug("%s: node %d, pgdat %08lx, node_mem_map %08lx\n",
diff --git a/mm/sparse.c b/mm/sparse.c
index 7af5e7a92528..65bb52599f90 100644
--- a/mm/sparse.c
+++ b/mm/sparse.c
@@ -427,10 +427,6 @@  struct page __init *sparse_mem_map_populate(unsigned long pnum, int nid,
 	struct page *map;
 	unsigned long size;
 
-	map = alloc_remap(nid, sizeof(struct page) * PAGES_PER_SECTION);
-	if (map)
-		return map;
-
 	size = PAGE_ALIGN(sizeof(struct page) * PAGES_PER_SECTION);
 	map = memblock_virt_alloc_try_nid(size,
 					  PAGE_SIZE, __pa(MAX_DMA_ADDRESS),
@@ -446,17 +442,6 @@  void __init sparse_mem_maps_populate_node(struct page **map_map,
 	unsigned long pnum;
 	unsigned long size = sizeof(struct page) * PAGES_PER_SECTION;
 
-	map = alloc_remap(nodeid, size * map_count);
-	if (map) {
-		for (pnum = pnum_begin; pnum < pnum_end; pnum++) {
-			if (!present_section_nr(pnum))
-				continue;
-			map_map[pnum] = map;
-			map += size;
-		}
-		return;
-	}
-
 	size = PAGE_ALIGN(size);
 	map = memblock_virt_alloc_try_nid_raw(size * map_count,
 					      PAGE_SIZE, __pa(MAX_DMA_ADDRESS),