Re: [PATCH 3/4] thp: fix split vs. unmap race

2015-11-05 Thread Kirill A. Shutemov
On Wed, Nov 04, 2015 at 05:20:15PM +0800, Hillf Danton wrote: > > @@ -1135,20 +1135,12 @@ void do_page_add_anon_rmap(struct page *page, > > bool compound = flags & RMAP_COMPOUND; > > bool first; > > > > - if (PageTransCompound(page)) { > > + if (compound) { > > + atomic_t

Re: [PATCH 3/4] thp: fix split vs. unmap race

2015-11-05 Thread Kirill A. Shutemov
On Wed, Nov 04, 2015 at 05:20:15PM +0800, Hillf Danton wrote: > > @@ -1135,20 +1135,12 @@ void do_page_add_anon_rmap(struct page *page, > > bool compound = flags & RMAP_COMPOUND; > > bool first; > > > > - if (PageTransCompound(page)) { > > + if (compound) { > > + atomic_t

Re: [PATCH 3/4] thp: fix split vs. unmap race

2015-11-04 Thread Hillf Danton
> @@ -1135,20 +1135,12 @@ void do_page_add_anon_rmap(struct page *page, > bool compound = flags & RMAP_COMPOUND; > bool first; > > - if (PageTransCompound(page)) { > + if (compound) { > + atomic_t *mapcount; > VM_BUG_ON_PAGE(!PageLocked(page), page);

Re: [PATCH 3/4] thp: fix split vs. unmap race

2015-11-04 Thread Hillf Danton
> @@ -1135,20 +1135,12 @@ void do_page_add_anon_rmap(struct page *page, > bool compound = flags & RMAP_COMPOUND; > bool first; > > - if (PageTransCompound(page)) { > + if (compound) { > + atomic_t *mapcount; > VM_BUG_ON_PAGE(!PageLocked(page), page);

[PATCH 3/4] thp: fix split vs. unmap race

2015-11-03 Thread Kirill A. Shutemov
To stabilize compound page during split we use migration entries. The code to implement this is buggy: I wrongly assumed that kernel would wait migration to finish, before zapping ptes. But turn out that's not true. As result if zap_pte_range() races with split_huge_page(), we can end up with

[PATCH 3/4] thp: fix split vs. unmap race

2015-11-03 Thread Kirill A. Shutemov
To stabilize compound page during split we use migration entries. The code to implement this is buggy: I wrongly assumed that kernel would wait migration to finish, before zapping ptes. But turn out that's not true. As result if zap_pte_range() races with split_huge_page(), we can end up with