linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: David Hildenbrand <david@redhat.com>
To: "Matthew Wilcox (Oracle)" <willy@infradead.org>,
	Andrew Morton <akpm@linux-foundation.org>
Cc: linux-mm@kvack.org
Subject: Re: [PATCH 7/9] mm: Convert migrate_vma_insert_page() to use a folio
Date: Tue, 12 Dec 2023 14:21:18 +0100	[thread overview]
Message-ID: <499ab649-7e0d-42ee-8f31-77a71e8bd1ef@redhat.com> (raw)
In-Reply-To: <20231211162214.2146080-8-willy@infradead.org>

On 11.12.23 17:22, Matthew Wilcox (Oracle) wrote:
> Replaces five calls to compound_head() with one.
> 
> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
> ---
>   mm/migrate_device.c | 23 ++++++++++++-----------
>   1 file changed, 12 insertions(+), 11 deletions(-)
> 
> diff --git a/mm/migrate_device.c b/mm/migrate_device.c
> index 8ac1f79f754a..81193363f8cd 100644
> --- a/mm/migrate_device.c
> +++ b/mm/migrate_device.c
> @@ -564,6 +564,7 @@ static void migrate_vma_insert_page(struct migrate_vma *migrate,
>   				    struct page *page,
>   				    unsigned long *src)
>   {
> +	struct folio *folio = page_folio(page);
>   	struct vm_area_struct *vma = migrate->vma;
>   	struct mm_struct *mm = vma->vm_mm;
>   	bool flush = false;
> @@ -596,17 +597,17 @@ static void migrate_vma_insert_page(struct migrate_vma *migrate,
>   		goto abort;
>   	if (unlikely(anon_vma_prepare(vma)))
>   		goto abort;
> -	if (mem_cgroup_charge(page_folio(page), vma->vm_mm, GFP_KERNEL))
> +	if (mem_cgroup_charge(folio, vma->vm_mm, GFP_KERNEL))
>   		goto abort;
>   
>   	/*
> -	 * The memory barrier inside __SetPageUptodate makes sure that
> -	 * preceding stores to the page contents become visible before
> +	 * The memory barrier inside __folio_mark_uptodate makes sure that
> +	 * preceding stores to the folio contents become visible before
>   	 * the set_pte_at() write.
>   	 */
> -	__SetPageUptodate(page);
> +	__folio_mark_uptodate(folio);
>   
> -	if (is_device_private_page(page)) {
> +	if (folio_is_device_private(folio)) {
>   		swp_entry_t swp_entry;
>   
>   		if (vma->vm_flags & VM_WRITE)
> @@ -617,8 +618,8 @@ static void migrate_vma_insert_page(struct migrate_vma *migrate,
>   						page_to_pfn(page));
>   		entry = swp_entry_to_pte(swp_entry);
>   	} else {
> -		if (is_zone_device_page(page) &&
> -		    !is_device_coherent_page(page)) {
> +		if (folio_is_zone_device(folio) &&
> +		    !folio_is_device_coherent(folio)) {
>   			pr_warn_once("Unsupported ZONE_DEVICE page type.\n");
>   			goto abort;
>   		}
> @@ -652,10 +653,10 @@ static void migrate_vma_insert_page(struct migrate_vma *migrate,
>   		goto unlock_abort;
>   
>   	inc_mm_counter(mm, MM_ANONPAGES);
> -	page_add_new_anon_rmap(page, vma, addr);
> -	if (!is_zone_device_page(page))
> -		lru_cache_add_inactive_or_unevictable(page, vma);
> -	get_page(page);
> +	folio_add_new_anon_rmap(folio, vma, addr);
> +	if (!folio_is_zone_device(folio))
> +		folio_add_lru_vma(folio, vma);
> +	folio_get(folio);
>   
>   	if (flush) {
>   		flush_cache_page(vma, addr, pte_pfn(orig_pte));

Reviewed-by: David Hildenbrand <david@redhat.com>

-- 
Cheers,

David / dhildenb



  parent reply	other threads:[~2023-12-12 13:21 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-11 16:22 [PATCH 0/9] Finish two folio conversions Matthew Wilcox (Oracle)
2023-12-11 16:22 ` [PATCH 1/9] mm: Convert ksm_might_need_to_copy() to work on folios Matthew Wilcox (Oracle)
2023-12-12 12:32   ` David Hildenbrand
2023-12-12 12:43     ` Matthew Wilcox
2023-12-12 12:43       ` David Hildenbrand
2023-12-11 16:22 ` [PATCH 2/9] mm: Simplify the assertions in unuse_pte() Matthew Wilcox (Oracle)
2023-12-12 12:26   ` David Hildenbrand
2023-12-12 13:52     ` Matthew Wilcox
2023-12-12 13:55       ` David Hildenbrand
2023-12-11 16:22 ` [PATCH 3/9] mm: Convert unuse_pte() to use a folio throughout Matthew Wilcox (Oracle)
2023-12-11 16:22 ` [PATCH 4/9] mm: Remove some calls to page_add_new_anon_rmap() Matthew Wilcox (Oracle)
2023-12-12 13:20   ` David Hildenbrand
2023-12-11 16:22 ` [PATCH 5/9] mm: Remove stale example from comment Matthew Wilcox (Oracle)
2023-12-12 13:20   ` David Hildenbrand
2023-12-11 16:22 ` [PATCH 6/9] mm: Remove references to page_add_new_anon_rmap in comments Matthew Wilcox (Oracle)
2023-12-12 13:20   ` David Hildenbrand
2023-12-11 16:22 ` [PATCH 7/9] mm: Convert migrate_vma_insert_page() to use a folio Matthew Wilcox (Oracle)
2023-12-11 22:17   ` Alistair Popple
2023-12-12 13:21   ` David Hildenbrand [this message]
2023-12-11 16:22 ` [PATCH 8/9] mm: Convert collapse_huge_page() " Matthew Wilcox (Oracle)
2023-12-12 13:21   ` David Hildenbrand
2023-12-11 16:22 ` [PATCH 9/9] mm: Remove page_add_new_anon_rmap and lru_cache_add_inactive_or_unevictable Matthew Wilcox (Oracle)
2023-12-12 13:21   ` David Hildenbrand

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=499ab649-7e0d-42ee-8f31-77a71e8bd1ef@redhat.com \
    --to=david@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-mm@kvack.org \
    --cc=willy@infradead.org \
    /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