Re: [PATCH v4] mm: per-thread vma caching

From: Linus Torvalds
Date: Sat Mar 08 2014 - 15:02:35 EST


On Sat, Mar 8, 2014 at 11:44 AM, Oleg Nesterov <oleg@xxxxxxxxxx> wrote:
>
> Sure. But another thread or CLONE_VM task can do vmacache_invalidate(),
> hit vmacache_seqnum == 0 and call vmacache_flush_all() to solve the
> problem with potential overflow.

How?

Any invalidation is supposed to hold the mm semaphore for writing. And
we should have it for reading.

That said, maybe we don't. Maybe we only get it in the dup_mm() path,
I didn't check. In that case, we should probably either get it, or do
some silly memory barrier thing ("check that the sequence number
didn't change between copying the cache and exposing the new thread").

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