From: Dave Hansen <dave@linux.vnet.ibm.com>
To: linux-mm@kvack.org, Mel Gorman <mgorman@suse.de>,
Andrew Morton <akpm@linux-foundation.org>,
LKML <linux-kernel@vger.kernel.org>
Subject: [3.7-rc6] capture_free_page() frees page without accounting for them??
Date: Tue, 20 Nov 2012 12:25:37 -0800 [thread overview]
Message-ID: <50ABE741.2020604@linux.vnet.ibm.com> (raw)
Hi Mel,
I'm chasing an apparent memory leak introduced post-3.6. The
interesting thing is that it appears that the pages are in the
allocator, but not being accounted for:
http://www.spinics.net/lists/linux-mm/msg46187.html
https://bugzilla.kernel.org/show_bug.cgi?id=50181
I started auditing anything that might be messing with NR_FREE_PAGES,
and came across commit 1fb3f8ca. It does something curious with
capture_free_page() (previously known as split_free_page()).
int capture_free_page(struct page *page, int alloc_order,
...
__mod_zone_page_state(zone, NR_FREE_PAGES, -(1UL << order));
- /* Split into individual pages */
- set_page_refcounted(page);
- split_page(page, order);
+ if (alloc_order != order)
+ expand(zone, page, alloc_order, order,
+ &zone->free_area[order], migratetype);
Note that expand() puts the pages _back_ in the allocator, but it does
not bump NR_FREE_PAGES. We "return" alloc_order' worth of pages, but we
accounted for removing 'order'.
I _think_ the correct fix is to just:
- __mod_zone_page_state(zone, NR_FREE_PAGES, -(1UL << order));
+ __mod_zone_page_state(zone, NR_FREE_PAGES, -(1UL << alloc_order));
I'm trying to confirm the theory my making this happen a bit more often,
but I'd appreciate a second pair of eyes on the code in case I'm reading
it wrong.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next reply other threads:[~2012-11-20 20:25 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-20 20:25 Dave Hansen [this message]
2012-11-21 0:48 ` [3.7-rc6] capture_free_page() frees page without accounting for them?? Dave Hansen
2012-11-21 14:33 ` Mel Gorman
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=50ABE741.2020604@linux.vnet.ibm.com \
--to=dave@linux.vnet.ibm.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mgorman@suse.de \
/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;
as well as URLs for NNTP newsgroup(s).