LKML Archive on lore.kernel.org
 help / Atom feed
From: Yang Shi <yang.shi@linux.alibaba.com>
To: Matthew Wilcox <willy@infradead.org>
Cc: mhocko@kernel.org, ldufour@linux.vnet.ibm.com,
	kirill@shutemov.name, vbabka@suse.cz, akpm@linux-foundation.org,
	peterz@infradead.org, mingo@redhat.com, acme@kernel.org,
	alexander.shishkin@linux.intel.com, jolsa@redhat.com,
	namhyung@kernel.org, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org
Subject: Re: [RFC v7 PATCH 1/4] mm: refactor do_munmap() to extract the common part
Date: Fri, 10 Aug 2018 11:23:45 -0700
Message-ID: <30ee3dd0-a794-1c93-dd22-5c643a9037a6@linux.alibaba.com> (raw)
In-Reply-To: <20180810174150.GA6487@bombadil.infradead.org>



On 8/10/18 10:41 AM, Matthew Wilcox wrote:
> On Fri, Aug 10, 2018 at 07:36:00AM +0800, Yang Shi wrote:
>> +static inline bool addr_ok(unsigned long start, size_t len)
> Maybe munmap_range_ok()?  Otherwise some of the conditions here don't make
> sense for such a generic sounding function.

I don't know. I think the argument is about munmap_ prefix should be used.

>
>>   {
>> -	unsigned long end;
>> -	struct vm_area_struct *vma, *prev, *last;
>> -
>>   	if ((offset_in_page(start)) || start > TASK_SIZE || len > TASK_SIZE-start)
>> -		return -EINVAL;
>> +		return false;
>>   
>> -	len = PAGE_ALIGN(len);
>> -	if (len == 0)
>> -		return -EINVAL;
>> +	if (PAGE_ALIGN(len) == 0)
>> +		return false;
>> +
>> +	return true;
>> +}
>> +
>> +/*
>> + * munmap_lookup_vma: find the first overlap vma and split overlap vmas.
>> + * @mm: mm_struct
>> + * @start: start address
>> + * @end: end address
>> + *
>> + * returns the pointer to vma, NULL or err ptr when spilt_vma returns error.
> kernel-doc prefers:
>
>   * Return: %NULL if no VMA overlaps this range.  An ERR_PTR if an
>   * overlapping VMA could not be split.  Otherwise a pointer to the first
>   * VMA which overlaps the range.

Ok, will fix it.

>
>> + */
>> +static struct vm_area_struct *munmap_lookup_vma(struct mm_struct *mm,
>> +			unsigned long start, unsigned long end)
>> +{
>> +	struct vm_area_struct *vma, *prev, *last;
>>   
>>   	/* Find the first overlapping VMA */
>>   	vma = find_vma(mm, start);
>>   	if (!vma)
>> -		return 0;
>> -	prev = vma->vm_prev;
>> -	/* we have  start < vma->vm_end  */
>> +		return NULL;
>>   
>> +	/* we have  start < vma->vm_end  */
> Can you remove the duplicate spaces here?

Sure

Thanks,
Yang



  reply index

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-09 23:35 [RFC v7 PATCH 0/4] mm: zap pages with read mmap_sem in munmap for large mapping Yang Shi
2018-08-09 23:36 ` [RFC v7 PATCH 1/4] mm: refactor do_munmap() to extract the common part Yang Shi
2018-08-10 10:20   ` Vlastimil Babka
2018-08-10 17:41   ` Matthew Wilcox
2018-08-10 18:23     ` Yang Shi [this message]
2018-08-09 23:36 ` [RFC v7 PATCH 2/4] mm: mmap: zap pages with read mmap_sem in munmap Yang Shi
2018-08-10 17:57   ` Matthew Wilcox
2018-08-10 18:26     ` Yang Shi
2018-08-09 23:36 ` [RFC v7 PATCH 3/4] uprobes: make vma_has_uprobes non-static Yang Shi
2018-08-09 23:36 ` [RFC v7 PATCH 4/4] mm: unmap special vmas with regular do_munmap() Yang Shi
2018-08-10  9:51   ` Vlastimil Babka
2018-08-10 11:59     ` Michal Hocko
2018-08-10 16:51     ` Yang Shi
2018-08-10 10:46   ` Vlastimil Babka
2018-08-10 17:00     ` Yang Shi

Reply instructions:

You may reply publically 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=30ee3dd0-a794-1c93-dd22-5c643a9037a6@linux.alibaba.com \
    --to=yang.shi@linux.alibaba.com \
    --cc=acme@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=jolsa@redhat.com \
    --cc=kirill@shutemov.name \
    --cc=ldufour@linux.vnet.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@kernel.org \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    --cc=vbabka@suse.cz \
    --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

LKML Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/lkml/0 lkml/git/0.git
	git clone --mirror https://lore.kernel.org/lkml/1 lkml/git/1.git
	git clone --mirror https://lore.kernel.org/lkml/2 lkml/git/2.git
	git clone --mirror https://lore.kernel.org/lkml/3 lkml/git/3.git
	git clone --mirror https://lore.kernel.org/lkml/4 lkml/git/4.git
	git clone --mirror https://lore.kernel.org/lkml/5 lkml/git/5.git
	git clone --mirror https://lore.kernel.org/lkml/6 lkml/git/6.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 lkml lkml/ https://lore.kernel.org/lkml \
		linux-kernel@vger.kernel.org linux-kernel@archiver.kernel.org
	public-inbox-index lkml


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-kernel


AGPL code for this site: git clone https://public-inbox.org/ public-inbox