Re: [PATCH v4] mm: prevent endless growth of anon_vma hierarchy

From: Rik van Riel
Date: Wed Dec 17 2014 - 11:36:36 EST


On 12/17/2014 02:57 AM, Konstantin Khlebnikov wrote:

> @@ -236,6 +240,13 @@ static inline void unlock_anon_vma_root(struct anon_vma *root)
> /*
> * Attach the anon_vmas from src to dst.
> * Returns 0 on success, -ENOMEM on failure.
> + *
> + * If dst->anon_vma is NULL this function tries to find and reuse existing
> + * anon_vma which has no vmas and only one child anon_vma. This prevents
> + * degradation of anon_vma hierarchy to endless linear chain in case of
> + * constantly forking task. In other hand anon_vma with more than one child
> + * isn't reused even if was no alive vma, thus rmap walker has a good chance
> + * to avoid scanning whole hieraryhy when it searches where page is mapped.
^^^^^^^^^
hierarchy

Other than that:

Reviewed-by: Rik van Riel <riel@xxxxxxxxxx>


Thanks for fixing this long standing issue, Konstantin.
--
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/