All of lore.kernel.org
 help / color / mirror / Atom feed
From: ebiederm@xmission.com (Eric W. Biederman)
To: Pekka Enberg <penberg@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	Rik van Riel <riel@redhat.com>, Hugh Dickins <hughd@google.com>
Subject: Re: [PATCH 2/3] mm: Consolidate vma destruction into remove_vma.
Date: Sun, 26 Sep 2010 23:44:50 -0700	[thread overview]
Message-ID: <m1zkv37kil.fsf@fess.ebiederm.org> (raw)
In-Reply-To: <AANLkTinHGKK-14jq=D__+Q20egPw07qFHg6iQo+aFC9R@mail.gmail.com> (Pekka Enberg's message of "Mon, 27 Sep 2010 09:39:46 +0300")

Pekka Enberg <penberg@kernel.org> writes:

> (Fixing Hugh's email address.)

Sorry about that somehow a typo crept it.

> On Mon, Sep 27, 2010 at 9:37 AM, Pekka Enberg <penberg@kernel.org> wrote:
>> Hi Eric,
>>
>> On Sun, Sep 26, 2010 at 2:34 AM, Eric W. Biederman
>> <ebiederm@xmission.com> wrote:
>>> Consolidate vma destruction in remove_vma.   This is slightly
>>> better for code size and for code maintenance.  Avoiding the pain
>>> of 3 copies of everything needed to tear down a vma.
>>>
>>> Signed-off-by: Eric W. Biederman <ebiederm@aristanetworks.com>
>>> ---
>>>  mm/mmap.c |   21 +++++----------------
>>>  1 files changed, 5 insertions(+), 16 deletions(-)
>>>
>>> diff --git a/mm/mmap.c b/mm/mmap.c
>>> index 6128dc8..17dd003 100644
>>> --- a/mm/mmap.c
>>> +++ b/mm/mmap.c
>>> @@ -643,16 +643,10 @@ again:                    remove_next = 1 + (end > next->vm_end);
>>>                spin_unlock(&mapping->i_mmap_lock);
>>>
>>>        if (remove_next) {
>>> -               if (file) {
>>> -                       fput(file);
>>> -                       if (next->vm_flags & VM_EXECUTABLE)
>>> -                               removed_exe_file_vma(mm);
>>> -               }
>>>                if (next->anon_vma)
>>>                        anon_vma_merge(vma, next);
>>> +               remove_vma(next);
>>
>> remove_vma() does vma->vm_ops->close() but we don't do that here. Are
>> you sure the conversion is safe?

Definitely.  It actually isn't possible to reach that point with a
vma that has a close method.

Until I had traced through all of the code paths I suspect calling
remove_vma there might have been a bug fix.

Eric

WARNING: multiple messages have this Message-ID (diff)
From: ebiederm@xmission.com (Eric W. Biederman)
To: Pekka Enberg <penberg@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	Rik van Riel <riel@redhat.com>, Hugh Dickins <hughd@google.com>
Subject: Re: [PATCH 2/3] mm: Consolidate vma destruction into remove_vma.
Date: Sun, 26 Sep 2010 23:44:50 -0700	[thread overview]
Message-ID: <m1zkv37kil.fsf@fess.ebiederm.org> (raw)
In-Reply-To: <AANLkTinHGKK-14jq=D__+Q20egPw07qFHg6iQo+aFC9R@mail.gmail.com> (Pekka Enberg's message of "Mon, 27 Sep 2010 09:39:46 +0300")

Pekka Enberg <penberg@kernel.org> writes:

> (Fixing Hugh's email address.)

Sorry about that somehow a typo crept it.

> On Mon, Sep 27, 2010 at 9:37 AM, Pekka Enberg <penberg@kernel.org> wrote:
>> Hi Eric,
>>
>> On Sun, Sep 26, 2010 at 2:34 AM, Eric W. Biederman
>> <ebiederm@xmission.com> wrote:
>>> Consolidate vma destruction in remove_vma.   This is slightly
>>> better for code size and for code maintenance.  Avoiding the pain
>>> of 3 copies of everything needed to tear down a vma.
>>>
>>> Signed-off-by: Eric W. Biederman <ebiederm@aristanetworks.com>
>>> ---
>>>  mm/mmap.c |   21 +++++----------------
>>>  1 files changed, 5 insertions(+), 16 deletions(-)
>>>
>>> diff --git a/mm/mmap.c b/mm/mmap.c
>>> index 6128dc8..17dd003 100644
>>> --- a/mm/mmap.c
>>> +++ b/mm/mmap.c
>>> @@ -643,16 +643,10 @@ again:                    remove_next = 1 + (end > next->vm_end);
>>>                spin_unlock(&mapping->i_mmap_lock);
>>>
>>>        if (remove_next) {
>>> -               if (file) {
>>> -                       fput(file);
>>> -                       if (next->vm_flags & VM_EXECUTABLE)
>>> -                               removed_exe_file_vma(mm);
>>> -               }
>>>                if (next->anon_vma)
>>>                        anon_vma_merge(vma, next);
>>> +               remove_vma(next);
>>
>> remove_vma() does vma->vm_ops->close() but we don't do that here. Are
>> you sure the conversion is safe?

Definitely.  It actually isn't possible to reach that point with a
vma that has a close method.

Until I had traced through all of the code paths I suspect calling
remove_vma there might have been a bug fix.

Eric

--
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>

  reply	other threads:[~2010-09-27  6:45 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-25 23:33 [PATCH 0/3] Generic support for revoking mappings Eric W. Biederman
2010-09-25 23:33 ` Eric W. Biederman
2010-09-25 23:33 ` [PATCH 1/3] mm: Introduce revoke_mappings Eric W. Biederman
2010-09-25 23:33   ` Eric W. Biederman
2010-09-27 10:49   ` Pekka Enberg
2010-09-27 10:49     ` Pekka Enberg
2010-09-27 14:23     ` Eric W. Biederman
2010-09-27 14:23       ` Eric W. Biederman
2010-09-25 23:34 ` [PATCH 2/3] mm: Consolidate vma destruction into remove_vma Eric W. Biederman
2010-09-25 23:34   ` Eric W. Biederman
2010-09-27  6:37   ` Pekka Enberg
2010-09-27  6:37     ` Pekka Enberg
2010-09-27  6:39     ` Pekka Enberg
2010-09-27  6:39       ` Pekka Enberg
2010-09-27  6:44       ` Eric W. Biederman [this message]
2010-09-27  6:44         ` Eric W. Biederman
2010-09-27  7:11         ` Pekka Enberg
2010-09-27  7:11           ` Pekka Enberg
2010-09-25 23:34 ` [PATCH 3/3] mm: Cause revoke_mappings to wait until all close methods have completed Eric W. Biederman
2010-09-25 23:34   ` Eric W. Biederman
2010-09-27  7:15   ` Pekka Enberg
2010-09-27  7:15     ` Pekka Enberg
2010-09-27  8:04     ` Eric W. Biederman
2010-09-27  8:04       ` Eric W. Biederman
2010-09-27  8:52 ` [PATCH 0/3] Generic support for revoking mappings CAI Qian
2010-09-27  8:52   ` CAI Qian
2010-09-27  9:12   ` Américo Wang
2010-09-27  9:12     ` Américo Wang

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=m1zkv37kil.fsf@fess.ebiederm.org \
    --to=ebiederm@xmission.com \
    --cc=akpm@linux-foundation.org \
    --cc=hughd@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=penberg@kernel.org \
    --cc=riel@redhat.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.