linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Muchun Song <songmuchun@bytedance.com>
To: Miaohe Lin <linmiaohe@huawei.com>
Cc: akpm@linux-foundation.org, shy828301@gmail.com,
	willy@infradead.org, zokeefe@google.com, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 04/16] mm/huge_memory: use helper touch_pud in huge_pud_set_accessed
Date: Tue, 28 Jun 2022 22:59:24 +0800	[thread overview]
Message-ID: <YrsXTMKqXcuMzRpF@FVFYT0MHHV2J.googleapis.com> (raw)
In-Reply-To: <20220628132835.8925-5-linmiaohe@huawei.com>

On Tue, Jun 28, 2022 at 09:28:23PM +0800, Miaohe Lin wrote:
> Use helper touch_pud to set pud accessed to simplify the code and improve
> the readability. No functional change intended.
> 
> Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
> ---
>  mm/huge_memory.c | 16 ++++------------
>  1 file changed, 4 insertions(+), 12 deletions(-)
> 
> diff --git a/mm/huge_memory.c b/mm/huge_memory.c
> index f7164ef8b6e3..d55d5efa06c8 100644
> --- a/mm/huge_memory.c
> +++ b/mm/huge_memory.c
> @@ -1284,15 +1284,15 @@ int copy_huge_pmd(struct mm_struct *dst_mm, struct mm_struct *src_mm,
>  
>  #ifdef CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD
>  static void touch_pud(struct vm_area_struct *vma, unsigned long addr,
> -		pud_t *pud, int flags)
> +		      pud_t *pud, bool write)

You have change the last parameter. Have you forgotten to update its user
of follow_devmap_pud()?

Thanks.

>  {
>  	pud_t _pud;
>  
>  	_pud = pud_mkyoung(*pud);
> -	if (flags & FOLL_WRITE)
> +	if (write)
>  		_pud = pud_mkdirty(_pud);
>  	if (pudp_set_access_flags(vma, addr & HPAGE_PUD_MASK,
> -				pud, _pud, flags & FOLL_WRITE))
> +				  pud, _pud, write))
>  		update_mmu_cache_pud(vma, addr, pud);
>  }
>  
> @@ -1384,21 +1384,13 @@ int copy_huge_pud(struct mm_struct *dst_mm, struct mm_struct *src_mm,
>  
>  void huge_pud_set_accessed(struct vm_fault *vmf, pud_t orig_pud)
>  {
> -	pud_t entry;
> -	unsigned long haddr;
>  	bool write = vmf->flags & FAULT_FLAG_WRITE;
>  
>  	vmf->ptl = pud_lock(vmf->vma->vm_mm, vmf->pud);
>  	if (unlikely(!pud_same(*vmf->pud, orig_pud)))
>  		goto unlock;
>  
> -	entry = pud_mkyoung(orig_pud);
> -	if (write)
> -		entry = pud_mkdirty(entry);
> -	haddr = vmf->address & HPAGE_PUD_MASK;
> -	if (pudp_set_access_flags(vmf->vma, haddr, vmf->pud, entry, write))
> -		update_mmu_cache_pud(vmf->vma, vmf->address, vmf->pud);
> -
> +	touch_pud(vmf->vma, vmf->address, vmf->pud, write);
>  unlock:
>  	spin_unlock(vmf->ptl);
>  }
> -- 
> 2.23.0
> 
> 


  reply	other threads:[~2022-06-28 14:59 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-28 13:28 [PATCH v2 00/16] A few cleanup patches for huge_memory Miaohe Lin
2022-06-28 13:28 ` [PATCH v2 01/16] mm/huge_memory: use flush_pmd_tlb_range in move_huge_pmd Miaohe Lin
2022-06-28 13:28 ` [PATCH v2 02/16] mm/huge_memory: access vm_page_prot with READ_ONCE in remove_migration_pmd Miaohe Lin
2022-06-28 13:28 ` [PATCH v2 03/16] mm/huge_memory: fix comment of __pud_trans_huge_lock Miaohe Lin
2022-06-28 13:28 ` [PATCH v2 04/16] mm/huge_memory: use helper touch_pud in huge_pud_set_accessed Miaohe Lin
2022-06-28 14:59   ` Muchun Song [this message]
2022-06-29  2:17     ` Miaohe Lin
2022-06-28 13:28 ` [PATCH v2 05/16] mm/huge_memory: use helper touch_pmd in huge_pmd_set_accessed Miaohe Lin
2022-06-28 15:01   ` Muchun Song
2022-06-28 13:28 ` [PATCH v2 06/16] mm/huge_memory: rename mmun_start to haddr in remove_migration_pmd Miaohe Lin
2022-06-28 13:28 ` [PATCH v2 07/16] mm/huge_memory: use helper function vma_lookup in split_huge_pages_pid Miaohe Lin
2022-06-28 13:28 ` [PATCH v2 08/16] mm/huge_memory: use helper macro __ATTR_RW Miaohe Lin
2022-06-28 13:28 ` [PATCH v2 09/16] mm/huge_memory: fix comment in zap_huge_pud Miaohe Lin
2022-06-28 13:28 ` [PATCH v2 10/16] mm/huge_memory: check pmd_present first in is_huge_zero_pmd Miaohe Lin
2022-06-28 13:28 ` [PATCH v2 11/16] mm/huge_memory: try to free subpage in swapcache when possible Miaohe Lin
2022-06-28 13:28 ` [PATCH v2 12/16] mm/huge_memory: minor cleanup for split_huge_pages_all Miaohe Lin
2022-06-28 13:28 ` [PATCH v2 13/16] mm/huge_memory: fix comment of page_deferred_list Miaohe Lin
2022-06-28 13:28 ` [PATCH v2 14/16] mm/huge_memory: correct comment of prep_transhuge_page Miaohe Lin
2022-06-28 13:28 ` [PATCH v2 15/16] mm/huge_memory: comment the subtly logic in __split_huge_pmd Miaohe Lin
2022-06-28 13:28 ` [PATCH v2 16/16] mm/huge_memory: use helper macro IS_ERR_OR_NULL in split_huge_pages_pid Miaohe Lin
2022-06-28 14:54   ` Muchun Song

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YrsXTMKqXcuMzRpF@FVFYT0MHHV2J.googleapis.com \
    --to=songmuchun@bytedance.com \
    --cc=akpm@linux-foundation.org \
    --cc=linmiaohe@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=shy828301@gmail.com \
    --cc=willy@infradead.org \
    --cc=zokeefe@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox