All of lore.kernel.org
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@redhat.com>
To: Chen Gang <xili_gchen_5257@hotmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	"kirill.shutemov@linux.intel.com"
	<kirill.shutemov@linux.intel.com>,
	"riel@redhat.com" <riel@redhat.com>,
	Michal Hocko <mhocko@suse.cz>,
	"sasha.levin@oracle.com" <sasha.levin@oracle.com>,
	"pfeiner@google.com" <pfeiner@google.com>,
	"aarcange@redhat.com" <aarcange@redhat.com>,
	"vishnu.ps@samsung.com" <vishnu.ps@samsung.com>,
	Linux Memory <linux-mm@kvack.org>,
	kernel mailing list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] mm/mmap.c: Remove useless statement "vma = NULL" in find_vma()
Date: Wed, 9 Sep 2015 18:26:05 +0200	[thread overview]
Message-ID: <20150909162605.GA4373@redhat.com> (raw)
In-Reply-To: <COL130-W6916929C85FB1943CC1B11B9530@phx.gbl>

On 09/08, Chen Gang wrote:
>
> I also want to consult: the comments of find_vma() says:

Sorry, I don't understand the question ;)

> "Look up the first VMA which satisfies addr < vm_end, ..."
>
> Is it OK?

Why not?

> (why not "vm_start <= addr < vm_end"),

Because this some callers actually want to find the 1st vma which
satisfies addr < vm_end? For example, shift_arg_pages().

OTOH, I think that another helper,

	find_vma_xxx(mm, addr)
	{
		vma = find_vma(...)
		if (vma && vma->vm_start > addr)
			vma = NULL;
		return vma;
	}

makes sense. It can have a lot of users.

> need we let "vma = tmp"
> in "if (tmp->vm_start <= addr)"? -- it looks the comments is not match
> the implementation, precisely (maybe not 1st VMA).

This contradicts with above... I mean, it is not clear what exactly do
you blame, semantics or implementation.

The implementation looks correct. Why do you think it can be not 1st vma?

Oleg.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

WARNING: multiple messages have this Message-ID (diff)
From: Oleg Nesterov <oleg@redhat.com>
To: Chen Gang <xili_gchen_5257@hotmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	"kirill.shutemov@linux.intel.com"
	<kirill.shutemov@linux.intel.com>,
	"riel@redhat.com" <riel@redhat.com>,
	Michal Hocko <mhocko@suse.cz>,
	"sasha.levin@oracle.com" <sasha.levin@oracle.com>,
	"pfeiner@google.com" <pfeiner@google.com>,
	"aarcange@redhat.com" <aarcange@redhat.com>,
	"vishnu.ps@samsung.com" <vishnu.ps@samsung.com>,
	Linux Memory <linux-mm@kvack.org>,
	kernel mailing list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] mm/mmap.c: Remove useless statement "vma = NULL" in find_vma()
Date: Wed, 9 Sep 2015 18:26:05 +0200	[thread overview]
Message-ID: <20150909162605.GA4373@redhat.com> (raw)
In-Reply-To: <COL130-W6916929C85FB1943CC1B11B9530@phx.gbl>

On 09/08, Chen Gang wrote:
>
> I also want to consult: the comments of find_vma() says:

Sorry, I don't understand the question ;)

> "Look up the first VMA which satisfies addr < vm_end, ..."
>
> Is it OK?

Why not?

> (why not "vm_start <= addr < vm_end"),

Because this some callers actually want to find the 1st vma which
satisfies addr < vm_end? For example, shift_arg_pages().

OTOH, I think that another helper,

	find_vma_xxx(mm, addr)
	{
		vma = find_vma(...)
		if (vma && vma->vm_start > addr)
			vma = NULL;
		return vma;
	}

makes sense. It can have a lot of users.

> need we let "vma = tmp"
> in "if (tmp->vm_start <= addr)"? -- it looks the comments is not match
> the implementation, precisely (maybe not 1st VMA).

This contradicts with above... I mean, it is not clear what exactly do
you blame, semantics or implementation.

The implementation looks correct. Why do you think it can be not 1st vma?

Oleg.


  reply	other threads:[~2015-09-09 16:28 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-05 14:03 [PATCH] mm/mmap.c: Remove useless statement "vma = NULL" in find_vma() Chen Gang
2015-09-07 12:36 ` Oleg Nesterov
2015-09-07 12:36   ` Oleg Nesterov
     [not found]   ` <55EEED66.6090509@hotmail.com>
2015-09-08 14:14     ` Chen Gang
2015-09-08 14:14       ` Chen Gang
2015-09-09 16:26       ` Oleg Nesterov [this message]
2015-09-09 16:26         ` Oleg Nesterov
     [not found]         ` <55F0B6C2.2000706@hotmail.com>
2015-09-09 22:44           ` Chen Gang
2015-09-09 22:44             ` Chen Gang
2015-09-10 18:19             ` Oleg Nesterov
2015-09-10 18:19               ` Oleg Nesterov
2015-09-10 22:20               ` Chen Gang
2015-09-10 22:20                 ` Chen Gang
2015-09-08 23:14 ` David Rientjes
2015-09-08 23:14   ` David Rientjes
  -- strict thread matches above, loose matches on Subject: below --
2015-09-03  3:52 gang.chen.5i5j
2015-09-03  4:02 ` Chen Gang

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=20150909162605.GA4373@redhat.com \
    --to=oleg@redhat.com \
    --cc=aarcange@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.cz \
    --cc=pfeiner@google.com \
    --cc=riel@redhat.com \
    --cc=sasha.levin@oracle.com \
    --cc=vishnu.ps@samsung.com \
    --cc=xili_gchen_5257@hotmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.