Re: [PATCH v2 2/4] mm: remove zone_lru_lock() function access ->lru_lock directly
From: Vlastimil Babka
Date: Thu Feb 28 2019 - 16:56:51 EST
On 2/28/2019 10:44 PM, John Hubbard wrote:
> Instead of removing that function, let's change it, and add another
> (since you have two cases: either a page* or a pgdat* is available),
> and move it to where it can compile, like this:
>
>
> diff --git a/include/linux/mm.h b/include/linux/mm.h
> index 80bb6408fe73..cea3437f5d68 100644
> --- a/include/linux/mm.h
> +++ b/include/linux/mm.h
> @@ -1167,6 +1167,16 @@ static inline pg_data_t *page_pgdat(const struct page *page)
> return NODE_DATA(page_to_nid(page));
> }
>
> +static inline spinlock_t *zone_lru_lock(pg_data_t *pgdat)
In that case it should now be named node_lru_lock(). zone_lru_lock() was a
wrapper introduced to make the conversion of per-zone to per-node lru_lock smoother.
> +{
> + return &pgdat->lru_lock;
> +}
> +
> +static inline spinlock_t *zone_lru_lock_from_page(struct page *page)
Ditto. Or maybe even page_node_lru_lock()?
> +{
> + return zone_lru_lock(page_pgdat(page));
> +}
> +
> #ifdef SECTION_IN_PAGE_FLAGS
> static inline void set_page_section(struct page *page, unsigned long section)
> {
> diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
> index 842f9189537b..e03042fe1d88 100644
> --- a/include/linux/mmzone.h
> +++ b/include/linux/mmzone.h
> @@ -728,11 +728,6 @@ typedef struct pglist_data {
>
> #define node_start_pfn(nid) (NODE_DATA(nid)->node_start_pfn)
> #define node_end_pfn(nid) pgdat_end_pfn(NODE_DATA(nid))
> -static inline spinlock_t *zone_lru_lock(struct zone *zone)
> -{
> - return &zone->zone_pgdat->lru_lock;
> -}
> -
> static inline struct lruvec *node_lruvec(struct pglist_data *pgdat)
> {
> return &pgdat->lruvec;
>
>
>
> Like it?
>
> thanks,
>