Re: [PATCH v20 04/20] mm/thp: use head for head page in lru_add_page_tail

Matthew Wilcox
2020-11-02T16:04:32Z

On Fri, Oct 30, 2020 at 10:46:54AM +0800, Alex Shi wrote:
> -static void lru_add_page_tail(struct page *page, struct page *page_tail,
> +static void lru_add_page_tail(struct page *head, struct page *tail,
> struct lruvec *lruvec, struct list_head *list)
> {
> - VM_BUG_ON_PAGE(!PageHead(page), page);
> - VM_BUG_ON_PAGE(PageCompound(page_tail), page);
> - VM_BUG_ON_PAGE(PageLRU(page_tail), page);
> + VM_BUG_ON_PAGE(!PageHead(head), head);
> + VM_BUG_ON_PAGE(PageCompound(tail), head);
> + VM_BUG_ON_PAGE(PageLRU(tail), head);

These last two should surely have been
VM_BUG_ON_PAGE(PageCompound(tail), tail);
VM_BUG_ON_PAGE(PageLRU(tail), tail);

Also, what do people think about converting these to VM_BUG_ON_PGFLAGS?

Either way:

Reviewed-by: Matthew Wilcox (Oracle) <willy@infradead.org>