Re: [PATCHi v2] mm: put_and_wait_on_page_locked() while page is migrated

2019-01-10 Thread Hugh Dickins
On Thu, 10 Jan 2019, Vlastimil Babka wrote: > > For the record, anyone backporting this to older kernels should make > sure to also include 605ca5ede764 ("mm/huge_memory.c: reorder operations > in __split_huge_page_tail()") or they are in for a lot of fun, like me. Thanks a lot for alerting us al

Re: [PATCHi v2] mm: put_and_wait_on_page_locked() while page is migrated

2019-01-10 Thread Vlastimil Babka
On 11/26/18 8:27 PM, Hugh Dickins wrote: > Waiting on a page migration entry has used wait_on_page_locked() all > along since 2006: but you cannot safely wait_on_page_locked() without > holding a reference to the page, and that extra reference is enough to > make migrate_page_move_mapping() fail wi

Re: [PATCHi v2] mm: put_and_wait_on_page_locked() while page is migrated

2018-11-27 Thread Joey Pabalinas
On Tue, Nov 27, 2018 at 01:08:50PM -0800, Hugh Dickins wrote: > On Tue, 27 Nov 2018, Mike Rapoport wrote: > > On Mon, Nov 26, 2018 at 11:27:07AM -0800, Hugh Dickins wrote: > > > > > > +/* > > > + * A choice of three behaviors for wait_on_page_bit_common(): > > > + */ > > > +enum behavior { > > > +

Re: [PATCHi v2] mm: put_and_wait_on_page_locked() while page is migrated

2018-11-27 Thread Mike Rapoport
On November 27, 2018 11:08:50 PM GMT+02:00, Hugh Dickins wrote: >On Tue, 27 Nov 2018, Mike Rapoport wrote: >> On Mon, Nov 26, 2018 at 11:27:07AM -0800, Hugh Dickins wrote: >> > >> > +/* >> > + * A choice of three behaviors for wait_on_page_bit_common(): >> > + */ >> > +enum behavior { >> > +

Re: [PATCHi v2] mm: put_and_wait_on_page_locked() while page is migrated

2018-11-27 Thread Hugh Dickins
On Tue, 27 Nov 2018, Mike Rapoport wrote: > On Mon, Nov 26, 2018 at 11:27:07AM -0800, Hugh Dickins wrote: > > > > +/* > > + * A choice of three behaviors for wait_on_page_bit_common(): > > + */ > > +enum behavior { > > + EXCLUSIVE, /* Hold ref to page and take the bit when woken, like > > +

Re: [PATCHi v2] mm: put_and_wait_on_page_locked() while page is migrated

2018-11-27 Thread Matthew Wilcox
On Tue, Nov 27, 2018 at 12:58:48PM +0200, Mike Rapoport wrote: > > diff --git a/mm/filemap.c b/mm/filemap.c > > index 81adec8ee02c..575e16c037ca 100644 > > --- a/mm/filemap.c > > +++ b/mm/filemap.c > > @@ -1049,25 +1056,44 @@ static void wake_up_page(struct page *page, int bit) > > wake_up_page

Re: [PATCHi v2] mm: put_and_wait_on_page_locked() while page is migrated

2018-11-27 Thread Linus Torvalds
On Tue, Nov 27, 2018 at 8:49 AM Christopher Lameter wrote: > > A process has no refcount on a page struct and is waiting for it to become > unlocked? Why? Should it not simply ignore that page and continue? The problem isn't that you can just "continue". You need to *retry*. And you can't just

Re: [PATCHi v2] mm: put_and_wait_on_page_locked() while page is migrated

2018-11-27 Thread Michal Hocko
On Tue 27-11-18 16:49:47, Cristopher Lameter wrote: > On Tue, 27 Nov 2018, Mike Rapoport wrote: > > > > * @page: The page to wait for. > > > * > > > * The caller should hold a reference on @page. They expect the page to > > > * become unlocked relatively soon, but do not wish to hold up migra

Re: [PATCHi v2] mm: put_and_wait_on_page_locked() while page is migrated

2018-11-27 Thread Christopher Lameter
On Tue, 27 Nov 2018, Mike Rapoport wrote: > > * @page: The page to wait for. > > * > > * The caller should hold a reference on @page. They expect the page to > > * become unlocked relatively soon, but do not wish to hold up migration > > * (for example) by holding the reference while waiting

Re: [PATCHi v2] mm: put_and_wait_on_page_locked() while page is migrated

2018-11-27 Thread Mike Rapoport
On Mon, Nov 26, 2018 at 11:27:07AM -0800, Hugh Dickins wrote: > Waiting on a page migration entry has used wait_on_page_locked() all > along since 2006: but you cannot safely wait_on_page_locked() without > holding a reference to the page, and that extra reference is enough to > make migrate_page_m

Re: [PATCHi v2] mm: put_and_wait_on_page_locked() while page is migrated

2018-11-27 Thread Mike Rapoport
On Mon, Nov 26, 2018 at 12:53:51PM -0800, Matthew Wilcox wrote: > On Mon, Nov 26, 2018 at 11:27:07AM -0800, Hugh Dickins wrote: > > Waiting on a page migration entry has used wait_on_page_locked() all > > along since 2006: but you cannot safely wait_on_page_locked() without > > holding a reference

Re: [PATCHi v2] mm: put_and_wait_on_page_locked() while page is migrated

2018-11-27 Thread Vlastimil Babka
On 11/26/18 8:27 PM, Hugh Dickins wrote: > Waiting on a page migration entry has used wait_on_page_locked() all > along since 2006: but you cannot safely wait_on_page_locked() without > holding a reference to the page, and that extra reference is enough to > make migrate_page_move_mapping() fail wi

Re: [PATCHi v2] mm: put_and_wait_on_page_locked() while page is migrated

2018-11-26 Thread Matthew Wilcox
On Mon, Nov 26, 2018 at 11:27:07AM -0800, Hugh Dickins wrote: > Waiting on a page migration entry has used wait_on_page_locked() all > along since 2006: but you cannot safely wait_on_page_locked() without > holding a reference to the page, and that extra reference is enough to > make migrate_page_m

Re: [PATCHi v2] mm: put_and_wait_on_page_locked() while page is migrated

2018-11-26 Thread Michal Hocko
On Mon 26-11-18 11:27:07, Hugh Dickins wrote: [...] > @@ -1049,25 +1056,44 @@ static void wake_up_page(struct page *page, int bit) > wake_up_page_bit(page, bit); > } > > +/* > + * A choice of three behaviors for wait_on_page_bit_common(): > + */ > +enum behavior { > + EXCLUSIVE, /

Re: [PATCHi v2] mm: put_and_wait_on_page_locked() while page is migrated

2018-11-26 Thread Linus Torvalds
On Mon, Nov 26, 2018 at 11:27 AM Hugh Dickins wrote: > > +enum behavior { > + EXCLUSIVE, /* Hold ref to page and take the bit when woken, like > +* __lock_page() waiting on then setting PG_locked. > +*/ > + SHARED, /* Hold re

[PATCHi v2] mm: put_and_wait_on_page_locked() while page is migrated

2018-11-26 Thread Hugh Dickins
Waiting on a page migration entry has used wait_on_page_locked() all along since 2006: but you cannot safely wait_on_page_locked() without holding a reference to the page, and that extra reference is enough to make migrate_page_move_mapping() fail with -EAGAIN, when a racing task faults on the entr