Re: [PATCH 2/3] mm: Consolidate vma destruction into remove_vma.

From: Eric W. Biederman
Date: Mon Sep 27 2010 - 02:45:05 EST


Pekka Enberg <penberg@xxxxxxxxxx> 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@xxxxxxxxxx> wrote:
>> Hi Eric,
>>
>> On Sun, Sep 26, 2010 at 2:34 AM, Eric W. Biederman
>> <ebiederm@xxxxxxxxxxxx> 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@xxxxxxxxxxxxxxxxxx>
>>> ---
>>> Â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 from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/