Re: [PATCH v5 2/8] mm/lru: replace pgdat lru_lock with lruvec lock

From: Matthew Wilcox
Date: Tue Dec 10 2019 - 08:41:38 EST


On Tue, Dec 10, 2019 at 07:46:18PM +0800, Alex Shi wrote:
> -static void lock_page_lru(struct page *page, int *isolated)
> +static struct lruvec *lock_page_lru(struct page *page, int *isolated)
> {
> - pg_data_t *pgdat = page_pgdat(page);
> + struct lruvec *lruvec = lock_page_lruvec_irq(page);
>
> - spin_lock_irq(&pgdat->lru_lock);
> if (PageLRU(page)) {
> - struct lruvec *lruvec;
>
> - lruvec = mem_cgroup_page_lruvec(page, pgdat);
> ClearPageLRU(page);
> del_page_from_lru_list(page, lruvec, page_lru(page));
> *isolated = 1;
> } else
> *isolated = 0;
> +
> + return lruvec;
> }

I still don't understand how this is supposed to work for !PageLRU
pages. Which lruvec have you locked if this page isn't on an LRU?