Re: [PATCH 02/30] Remove struct mm_struct::exe_file et al

From: Ingo Molnar
Date: Fri Apr 10 2009 - 04:55:19 EST



* Alexey Dobriyan <adobriyan@xxxxxxxxx> 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.

Thanks,

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