Subject: Re: linux-next: manual merge of the akpm-current tree with the hmm tree

From: Jason Gunthorpe <[email-masked]>
Date: Thu, 4 Jul 2019 12:55:43 +0000

On Thu, Jul 04, 2019 at 08:55:36PM +1000, Stephen Rothwell wrote:
> Hi all,
> 
> Today's linux-next merge of the akpm-current tree got a conflict in:
> 
>   mm/memory_hotplug.c
> 
> between commit:
> 
>   514caf23a70f ("memremap: replace the altmap_valid field with a PGMAP_ALTMAP_VALID flag")
> 
> from the hmm tree and commit:
> 
>   db30f881e2d7 ("mm/hotplug: kill is_dev_zone() usage in __remove_pages()")

There must be another commit involved for the 'unsigned long nr,
start_sec, end_sec;' lines..
 
> from the akpm-current tree.
> 
> I fixed it up (I think - see below) and can carry the fix as
> necessary. This is now fixed as far as linux-next is concerned, but any
> non trivial conflicts should be mentioned to your upstream maintainer
> when your tree is submitted for merging.  You may also want to consider
> cooperating with the maintainer of the conflicting tree to minimise any
> particularly complex conflicts.
> 
> -- 
> Cheers,
> Stephen Rothwell
> 
> diff --cc mm/memory_hotplug.c
> index 6166ba5a15f3,dfab21dc33dc..000000000000
> --- a/mm/memory_hotplug.c
> +++ b/mm/memory_hotplug.c
> @@@ -549,16 -537,14 +537,13 @@@ static void __remove_section(struct zon
>    * sure that pages are marked reserved and zones are adjust properly by
>    * calling offline_pages().
>    */
> - void __remove_pages(struct zone *zone, unsigned long phys_start_pfn,
> + void __remove_pages(struct zone *zone, unsigned long pfn,
>   		    unsigned long nr_pages, struct vmem_altmap *altmap)
>   {
> - 	unsigned long i;
> --	unsigned long map_offset = 0;
> - 	int sections_to_remove;
> ++	unsigned long map_offset;
> + 	unsigned long nr, start_sec, end_sec;
>   
> - 	/* In the ZONE_DEVICE case device driver owns the memory region */
> - 	if (is_dev_zone(zone))
>  -	if (altmap)
> --		map_offset = vmem_altmap_offset(altmap);
> ++	map_offset = vmem_altmap_offset(altmap);
>   
>   	clear_zone_contiguous(zone);
>   

This looks OK to me. After the trees are merged vmem_altmap_offset()
returns 0 if !altmap, so the code is equivalent.

Jason