From: Jay Cornwall <jay@jcornwall.me>
To: linux-kernel@vger.kernel.org
Subject: put_page on transparent huge page leaks?
Date: Fri, 21 Feb 2014 11:23:39 -0600 [thread overview]
Message-ID: <ff08f2ccbcd50d2d353392a81defe619@jcornwall.me> (raw)
Hi,
I'm tracking a possible memory leak in iommu/amd. The driver uses this
logic to fault a page in response to a PRI from a device:
npages = get_user_pages(fault->state->task, fault->state->mm,
fault->address, 1, write, 0, &page, NULL);
if (npages == 1)
put_page(page);
else
...
This works correctly when get_user_pages returns a 4KB page. When
transparent huge pages are enabled any 2MB page returned by this call
appears to leak on process exit. The non-cached memory usage stays
elevated by the set of faulted 2MB pages. This behavior is not observed
when the exception handler demand faults 2MB pages.
I notice there is a difference in reference count between the 4KB/2MB
paths.
get_user_pages (4KB): page_count()=3, page_mapcount()=1
put_page (4KB): page_count()=2, page_mapcount()=1
get_user_pages (2MB): page_count()=3, page_mapcount()=1
put_page (2MB): page_count()=3, page_mapcount()=0
I'm concerned that the driver appears to be holding a reference count
after put_page(). Am I interpreting this observation correctly?
next reply other threads:[~2014-02-21 17:33 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-21 17:23 Jay Cornwall [this message]
2014-02-22 2:31 ` put_page on transparent huge page leaks? Kirill A. Shutemov
2014-02-22 17:44 ` Jay Cornwall
2014-02-22 19:31 ` Jay Cornwall
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ff08f2ccbcd50d2d353392a81defe619@jcornwall.me \
--to=jay@jcornwall.me \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox