[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YPfsWdV6AyrFOWsG@kernel.org>
Date: Wed, 21 Jul 2021 12:43:53 +0300
From: Mike Rapoport <rppt@...nel.org>
To: "Matthew Wilcox (Oracle)" <willy@...radead.org>
Cc: linux-kernel@...r.kernel.org, linux-mm@...ck.org,
linux-fsdevel@...r.kernel.org, Christoph Hellwig <hch@....de>
Subject: Re: [PATCH v14 048/138] mm/memcg: Add folio_lruvec_lock() and
similar functions
On Thu, Jul 15, 2021 at 04:35:34AM +0100, Matthew Wilcox (Oracle) wrote:
> These are the folio equivalents of lock_page_lruvec() and similar
> functions. Also convert lruvec_memcg_debug() to take a folio.
>
> Signed-off-by: Matthew Wilcox (Oracle) <willy@...radead.org>
> Reviewed-by: Christoph Hellwig <hch@....de>
> ---
> include/linux/memcontrol.h | 32 ++++++++++++++-----------
> mm/compaction.c | 2 +-
> mm/huge_memory.c | 5 ++--
> mm/memcontrol.c | 48 ++++++++++++++++----------------------
> mm/rmap.c | 2 +-
> mm/swap.c | 8 ++++---
> mm/vmscan.c | 3 ++-
> 7 files changed, 50 insertions(+), 50 deletions(-)
>
> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> index fd578d70b579..5935f06316b1 100644
> --- a/mm/memcontrol.c
> +++ b/mm/memcontrol.c
> @@ -1158,67 +1158,59 @@ int mem_cgroup_scan_tasks(struct mem_cgroup *memcg,
> }
>
> #ifdef CONFIG_DEBUG_VM
> -void lruvec_memcg_debug(struct lruvec *lruvec, struct page *page)
> +void lruvec_memcg_debug(struct lruvec *lruvec, struct folio *folio)
> {
> struct mem_cgroup *memcg;
>
> if (mem_cgroup_disabled())
> return;
>
> - memcg = page_memcg(page);
> + memcg = folio_memcg(folio);
>
> if (!memcg)
> - VM_BUG_ON_PAGE(lruvec_memcg(lruvec) != root_mem_cgroup, page);
> + VM_BUG_ON_FOLIO(lruvec_memcg(lruvec) != root_mem_cgroup, folio);
> else
> - VM_BUG_ON_PAGE(lruvec_memcg(lruvec) != memcg, page);
> + VM_BUG_ON_FOLIO(lruvec_memcg(lruvec) != memcg, folio);
> }
> #endif
>
> /**
> - * lock_page_lruvec - lock and return lruvec for a given page.
> - * @page: the page
> + * folio_lruvec_lock - lock and return lruvec for a given folio.
> + * @folio: Pointer to the folio.
> *
> * These functions are safe to use under any of the following conditions:
> - * - page locked
> - * - PageLRU cleared
> - * - lock_page_memcg()
> - * - page->_refcount is zero
> + * - folio locked
> + * - folio_test_lru false
> + * - folio_memcg_lock()
> + * - folio frozen (refcount of 0)
Missing return description
> */
> -struct lruvec *lock_page_lruvec(struct page *page)
> +struct lruvec *folio_lruvec_lock(struct folio *folio)
> {
> - struct folio *folio = page_folio(page);
> - struct lruvec *lruvec;
> + struct lruvec *lruvec = folio_lruvec(folio);
>
> - lruvec = folio_lruvec(folio);
> spin_lock(&lruvec->lru_lock);
> -
> - lruvec_memcg_debug(lruvec, page);
> + lruvec_memcg_debug(lruvec, folio);
>
> return lruvec;
> }
>
--
Sincerely yours,
Mike.
Powered by blists - more mailing lists