Thread (21 messages) 21 messages, 3 authors, 2020-02-05

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

From: John Hubbard <jhubbard@nvidia.com>
Date: 2020-02-05 23:13:36
Also in: linux-doc, linux-fsdevel, linux-kselftest, linux-rdma, lkml
Subsystem: memory management, memory management - gup (get user pages), the rest · Maintainers: Andrew Morton, David Hildenbrand, Linus Torvalds

On 2/5/20 1:37 AM, Jan Kara wrote:
...
quoted
@@ -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?

Yes, that was definitely missing. I've added this for the next version:

diff --git a/mm/gup.c b/mm/gup.c
index 7c543849181b..ae503c51bc7f 100644
--- a/mm/gup.c
+++ b/mm/gup.c
@@ -2268,6 +2268,8 @@ static int record_subpages(struct page *page, unsigned long addr,
 
 static void put_compound_head(struct page *page, int refs, unsigned int flags)
 {
+       int orig_refs = refs;
+
        if (flags & FOLL_PIN) {
                if (hpage_pincount_available(page))
                        hpage_pincount_sub(page, refs);
@@ -2283,6 +2285,8 @@ static void put_compound_head(struct page *page, int refs, unsigned int flags)
        if (refs > 1)
                page_ref_sub(page, refs - 1);
        put_page(page);
+
+       mod_node_page_state(page_pgdat(page), NR_FOLL_PIN_RELEASED, orig_refs);
 }
 
 #ifdef CONFIG_ARCH_HAS_HUGEPD


Otherwise I like the new stat names better :).

								Honza
Glad to hear that! :)

thanks,
-- 
John Hubbard
NVIDIA
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help