Re: [PATCH v4 10/12] mm/gup: /proc/vmstat: pin_user_pages (FOLL_PIN) reporting

Jan Kara
2020-02-05T09:37:46Z

On Tue 04-02-20 15:41:15, John Hubbard wrote:
> Now that pages are "DMA-pinned" via pin_user_page*(), and unpinned via
> unpin_user_pages*(), we need some visibility into whether all of this is
> working correctly.
>
> Add two new fields to /proc/vmstat:
>
> nr_foll_pin_acquired
> nr_foll_pin_released
>
> These are documented in Documentation/core-api/pin_user_pages.rst.
> They represent the number of pages (since boot time) that have been
> pinned ("nr_foll_pin_acquired") and unpinned ("nr_foll_pin_released"),
> via pin_user_pages*() and unpin_user_pages*().
>
> In the absence of long-running DMA or RDMA operations that hold pages
> pinned, the above two fields will normally be equal to each other.
>
> Also: update Documentation/core-api/pin_user_pages.rst, to remove an
> earlier (now confirmed untrue) claim about a performance problem with
> /proc/vmstat.
>
> Also: updated Documentation/core-api/pin_user_pages.rst to rename the
> new /proc/vmstat entries, to the names listed here.
>
> Signed-off-by: John Hubbard <jhubbard@nvidia.com>

...

> @@ -104,6 +106,9 @@ static __maybe_unused struct page *try_grab_compound_head(struct page *page,
> if (hpage_pincount_available(page))
> hpage_pincount_add(page, refs);
>
> + mod_node_page_state(page_pgdat(page), NR_FOLL_PIN_ACQUIRED,
> + orig_refs);
> +
> return page;
> }
>

It seems to me you miss mod_node_page_state() in put_compound_head(), don't
you?

Otherwise I like the new stat names better :).

Honza
--
Jan Kara <jack@suse.com>
SUSE Labs, CR