Re: [PATCH v2 1/1] mm: fix the theoretical compound_lock() vsprep_new_page() race

From: Mel Gorman
Date: Fri Jan 10 2014 - 11:12:58 EST


On Thu, Jan 09, 2014 at 03:04:47PM +0100, Oleg Nesterov wrote:
>
> > #ifdef CONFIG_TRANSPARENT_HUGEPAGE
> > page_head = page;
> > if (unlikely(PageTail(page))) {
> > put_page(page);
> >
> >
> > so I'm still not seeing how a tail page racing with a split ends up with
> > mayhem.
>
> But get/put(page_tail) plays with page_head which can be freed/reallocated,
> it does compound_lock(page_head).
>
> > I could also still be stuck in a "la la la, everything is fine" mode.
>
> More likely it is me who tries to deny the fact I missed something ;)
>

My hangup was that this was related to futex and I was focusing it as
a specific example that made the patch necessary. However, this is a
therotical case that potentially impacts a put_page if it mistakenly
believes it is still a tail page when it's not due a a parallel split. I
see and understand that race and while I think the patch is overkill, I
have no problem with including it at the start of a series that reexamines
the locking in that area. It makes for a suitable -stable backport and
I hope/expect the reworked locking would then remove the barrier again
for upstream.

I haven't looked at the reworked locking but understand there is a v3 on
the way so I'll wait until that happens and work my way through it.

Thanks and sorry for the noise.

--
Mel Gorman
SUSE Labs
--
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/