linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "Liam R. Howlett" <Liam.Howlett@Oracle.com>
To: Helge Deller <deller@gmx.de>
Cc: Yajun Deng <yajun.deng@linux.dev>,
	akpm@linux-foundation.org, vbabka@suse.cz, lstoakes@gmail.com,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] mm/mmap: convert all mas except mas_detach to vma iterator
Date: Mon, 26 Feb 2024 13:00:36 -0500	[thread overview]
Message-ID: <20240226180036.dwchqlq45p4zdz34@revolver> (raw)
In-Reply-To: <20240226061624.860382-1-yajun.deng@linux.dev>

> There are two types of iterators mas and vmi in the current code. If the
> maple tree comes from the mm struct, we can use the vma iterator. Avoid
> using mas directly as possible.
> 

Helge,

Yajun has changed code that affects parisc with this patch, which hasn't
been tested.



* Yajun Deng <yajun.deng@linux.dev> [240226 01:16]:
> Keep using mas for the mt_detach tree, since it doesn't come from the mm
> struct.
> 
> Remove as many mas uses as feasible, but we will still have a few that
> must be passed through in unmap_vmas() and free_pgtables().
> 
> Also introduce vma_iter_reset, vma_iter_{prev, next}_range_limit and
> vma_iter_area_{lowest, highest} helper functions for using vma interator.
> 
> Signed-off-by: Yajun Deng <yajun.deng@linux.dev>
> ---
> v2: Add vma_iter_reset() and vma_iter_{prev, next}_range_limit() helper functions.
> v1: https://lore.kernel.org/all/9f76ce23-67b1-ccbe-a722-1db0e8f0a408@linux.dev/
> ---

...

>  
> @@ -1975,7 +1974,7 @@ static int expand_upwards(struct vm_area_struct *vma, unsigned long address)
>  	struct vm_area_struct *next;
>  	unsigned long gap_addr;
>  	int error = 0;
> -	MA_STATE(mas, &mm->mm_mt, vma->vm_start, address);
> +	VMA_ITERATOR(vmi, mm, vma->vm_start);
>  
>  	if (!(vma->vm_flags & VM_GROWSUP))
>  		return -EFAULT;
> @@ -2001,15 +2000,15 @@ static int expand_upwards(struct vm_area_struct *vma, unsigned long address)
>  	}
>  
>  	if (next)
> -		mas_prev_range(&mas, address);
> +		vma_iter_prev_range_limit(&vmi, address);
>  
> -	__mas_set_range(&mas, vma->vm_start, address - 1);
> -	if (mas_preallocate(&mas, vma, GFP_KERNEL))
> +	vma_iter_config(&vmi, vma->vm_start, address);
> +	if (vma_iter_prealloc(&vmi, vma))
>  		return -ENOMEM;
>  
>  	/* We must make sure the anon_vma is allocated. */
>  	if (unlikely(anon_vma_prepare(vma))) {
> -		mas_destroy(&mas);
> +		vma_iter_free(&vmi);
>  		return -ENOMEM;
>  	}
>  
> @@ -2049,7 +2048,7 @@ static int expand_upwards(struct vm_area_struct *vma, unsigned long address)
>  				anon_vma_interval_tree_pre_update_vma(vma);
>  				vma->vm_end = address;
>  				/* Overwrite old entry in mtree. */
> -				mas_store_prealloc(&mas, vma);
> +				vma_iter_store(&vmi, vma);
>  				anon_vma_interval_tree_post_update_vma(vma);
>  				spin_unlock(&mm->page_table_lock);
>  
> @@ -2058,7 +2057,7 @@ static int expand_upwards(struct vm_area_struct *vma, unsigned long address)
>  		}
>  	}
>  	anon_vma_unlock_write(vma->anon_vma);
> -	mas_destroy(&mas);
> +	vma_iter_free(&vmi);
>  	validate_mm(mm);
>  	return error;
>  }

Can you make sure that the expand_upwards() still functions on parisc?

Thanks,
Liam
...


      reply	other threads:[~2024-02-26 18:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-26  6:16 Yajun Deng
2024-02-26 18:00 ` Liam R. Howlett [this message]

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=20240226180036.dwchqlq45p4zdz34@revolver \
    --to=liam.howlett@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=deller@gmx.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=lstoakes@gmail.com \
    --cc=vbabka@suse.cz \
    --cc=yajun.deng@linux.dev \
    /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