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

From: Will Deacon <[email-masked]>
Date: Mon, 10 Dec 2012 11:13:46 +0000

Hi guys,

On Mon, Dec 10, 2012 at 08:01:39AM +0000, Stephen Rothwell wrote:
> Today's linux-next merge of the akpm tree got a conflict in mm/memory.c
> between changes in commits from the tip tree and commit "mm: thp: set the
> accessed flag for old pages on access fault" from the akpm tree.
> 
> I fixed it up (I think - see below) and can carry the fix as necessary
> (no action is required).

[...]

> diff --cc mm/memory.c
> index 8022526,60201d5..0000000
> --- a/mm/memory.c
> +++ b/mm/memory.c
> @@@ -3812,15 -3620,18 +3812,17 @@@ retry
>   							  pmd, flags);
>   	} else {
>   		pmd_t orig_pmd = *pmd;
>  -		int ret = 0;
>  +		int ret;
>   
>   		barrier();
>  -		if (pmd_trans_huge(orig_pmd) && !pmd_trans_splitting(orig_pmd)) {
>  +		if (pmd_trans_huge(orig_pmd)) {

This change worries me a bit wrt the huge_pmd_set_accessed function I
introduce below. Unfortunately, current -next doesn't seem to include it, so
I can't see whether do_huge_pmd_numa_page / do_huge_pmd_wp_page have been
changed to deal with the splitting or whether the check has been moved
earlier.

Will

> + 			unsigned int dirty = flags & FAULT_FLAG_WRITE;
> + 
>  -			if (pmd_numa(vma, orig_pmd)) {
>  -				do_huge_pmd_numa_page(mm, vma, address, pmd,
>  -						      flags, orig_pmd);
>  -			}
>  +			if (pmd_numa(*pmd))
>  +				return do_huge_pmd_numa_page(mm, vma, address,
>  +							     orig_pmd, pmd);
>   
> - 			if ((flags & FAULT_FLAG_WRITE) && !pmd_write(orig_pmd)) {
> + 			if (dirty && !pmd_write(orig_pmd)) {
>   				ret = do_huge_pmd_wp_page(mm, vma, address, pmd,
>   							  orig_pmd);
>   				/*
> @@@ -3830,10 -3641,12 +3832,13 @@@
>   				 */
>   				if (unlikely(ret & VM_FAULT_OOM))
>   					goto retry;
>  +				return ret;
> + 			} else {
> + 				huge_pmd_set_accessed(mm, vma, address, pmd,
> + 						      orig_pmd, dirty);
>   			}
>   
>  -			return ret;
>  +			return 0;
>   		}
>   	}
>