Re: Re: [PATCH v2 13/18] mm/compaction: support non-lru movable pagemigration

From: Minchan Kim
Date: Thu Mar 24 2016 - 01:10:24 EST


On Thu, Mar 24, 2016 at 05:26:50AM +0900, Gioh Kim wrote:
> Hmmm... But, in failure case, is it safe to call putback_lru_page() for
> them?
> And, PageIsolated() would be left. Is it okay? It's not symmetric that
> isolated page can be freed by decreasing ref count without calling
> putback function. This should be clarified and documented.
>
> I agree Joonsoo's idea.
>
> Freeing isolated page out of putback() could be confused.

If we makes such rule, subsystem cannot free the isolated pages until VM calls
putback. I don't think it's a good idea. With it, every users should make own
deferred page freeing logic which might be more error-prone and obstacle for
using this interface.

I want to make client free his pages whenever he want if possible.

>
> Every detail cannot be documented. And more documents mean less elegant
> code.
>
> Is it possible to free isolated page in putback()?
>
> In move_to_new_page(), can we call a_ops->migratepage like following?
>
> move_to_new_page()
>
> {
>
> mapping = page_mapping(page)
>
> if (!mapping)
>
> rc = migrate_page
>
> else if (mapping->a_ops->migratepage && IsolatePage(page))
>
> rc = mapping->a_ops->migratepage
>

It's not a problem. The problem is that a page failed migration
so VM will putback the page. But, between fail of migration and
putback of isolated page, user can free the page. In this case,
putback operation would be not called and pass the page in
putback_lru_page.


> else
>
> rc = fallback_migrate_page
>
> ...
>
> return rc
>
> }
>
> I'm sorry that I couldn't review in detail because I forgot many
> details.

You're a human being, not Alphago. :)

Thanks for the review, Gioh!

>
> [1][Kk8NwEH1.I.q95.FfPs-qw00]
> [@from=gurugio&rcpt=minchan%40kernel%2Eorg&msgid=%3C20160324052650%2EHM
> %2Ee0000000006t8Yn%40gurugio%2Ewwl1662%2Ehanmail%2Enet%3E]
>
> References
>
> 1. mailto:gurugio@xxxxxxxxxxx