[Devel] Re: [PATCH 02/30] Remove struct mm_struct::exe_file et al
Eric W. Biederman
ebiederm at xmission.com
Fri Apr 10 09:22:28 PDT 2009
Ingo Molnar <mingo at elte.hu> writes:
> * Alexey Dobriyan <adobriyan at gmail.com> wrote:
>
>> Commit 925d1c401fa6cfd0df5d2e37da8981494ccdec07 aka "procfs task
>> exe symlink". introduced struct mm_struct::exe_file and struct
>> mm_struct::num_exe_file_vmas.
>>
>> The rationale is weak: unifying MMU and no-MMU version of
>> /proc/*/exe code. For this a) struct mm_struct becomes bigger, b)
>> mmap/munmap/exit become slower, c) patch adds more code than
>> removes in fact.
>
> Hm, nommu unification was not the only effect of that original
> patch.
>
> The other effect was to introduce a managed 'which is the first
> executable vma in the mm' abstraction in struct mm. Your patch
> removes that abstraction and re-introduces a linear ->vma_next walk:
>
>> + down_read(&mm->mmap_sem);
>> + for (vma = mm->mmap; vma; vma = vma->vm_next) {
>> + if ((vma->vm_flags & VM_EXECUTABLE) && vma->vm_file) {
>
> Which can walk along thousands (or tens of thousands) of vmas until
> it finds the first executable vma. For example on PIE binaries it's
> quite possible to have a lot of non-PROT_EXEC vmas before the first
> EXEC vma is met.
>
> So your revert reintroduces that linear walk. It might not matter
> much (/proc/*/exe might be sufficiently uninteresting in practice to
> not deserve an optimization), but it's still worth a mention and a
> discussion in the changelog.
There is also Andrew Morton's suggestion of just keeping a struct path
in mm_struct instead of struct file. That should be the best of both
worlds.
Eric
_______________________________________________
Containers mailing list
Containers at lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/containers
More information about the Devel
mailing list