From: Andi Kleen <andi@firstfloor.org>
To: linux-mm@kvack.org
Cc: penberg@cs.helsinki.fi, cl@linux-foundation.org, mpm@selenic.com,
Andi Kleen <ak@linux.intel.com>,
fengguang.wu@intel.com
Subject: [PATCH 2/2] HWPOISON: Attempt directed shrinking of slabs
Date: Wed, 6 Oct 2010 23:02:10 +0200 [thread overview]
Message-ID: <1286398930-11956-3-git-send-email-andi@firstfloor.org> (raw)
In-Reply-To: <1286398930-11956-1-git-send-email-andi@firstfloor.org>
From: Andi Kleen <ak@linux.intel.com>
When a slab page is found try to shrink the specific slab first
before trying to shrink all slabs and call other shrinkers.
This can be done now using the new kmem_page_cache() call.
Cc: fengguang.wu@intel.com
Signed-off-by: Andi Kleen <ak@linux.intel.com>
---
mm/memory-failure.c | 18 ++++++++++++++++++
1 files changed, 18 insertions(+), 0 deletions(-)
diff --git a/mm/memory-failure.c b/mm/memory-failure.c
index 9c26eec..b49d81a 100644
--- a/mm/memory-failure.c
+++ b/mm/memory-failure.c
@@ -212,6 +212,20 @@ static int kill_proc_ao(struct task_struct *t, unsigned long addr, int trapno,
return ret;
}
+/*
+ * Try to free a slab page by shrinking the slab.
+ */
+static int shake_slab(struct page *p)
+{
+ struct kmem_cache *cache;
+
+ cache = kmem_page_cache(p);
+ if (!cache)
+ return 0;
+ kmem_cache_shrink(cache);
+ return page_count(p) == 1;
+}
+
/*
* When a unknown page type is encountered drain as many buffers as possible
* in the hope to turn the page into a LRU or free page, which we can handle.
@@ -233,6 +247,10 @@ void shake_page(struct page *p, int access)
*/
if (access) {
int nr;
+
+ if (shake_slab(p))
+ return;
+
do {
nr = shrink_slab(1000, GFP_KERNEL, 1000);
if (page_count(p) == 0)
--
1.7.1
--
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 prev parent reply other threads:[~2010-10-06 21:02 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-06 21:02 HWPOISON/SLAB: Allow shrinking of specific slab cache Andi Kleen
2010-10-06 21:02 ` [PATCH 1/2] SLAB: Add function to get slab cache for a page Andi Kleen
2010-10-06 21:42 ` Christoph Lameter
2010-10-07 5:34 ` Pekka Enberg
2010-10-07 6:34 ` Andi Kleen
2010-10-06 21:02 ` Andi Kleen [this message]
2010-10-06 21:26 ` [PATCH 2/2] HWPOISON: Attempt directed shrinking of slabs Christoph Lameter
2010-10-06 21:42 ` Andi Kleen
2010-10-06 21:44 ` Christoph Lameter
2010-10-06 21:55 ` Andi Kleen
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=1286398930-11956-3-git-send-email-andi@firstfloor.org \
--to=andi@firstfloor.org \
--cc=ak@linux.intel.com \
--cc=cl@linux-foundation.org \
--cc=fengguang.wu@intel.com \
--cc=linux-mm@kvack.org \
--cc=mpm@selenic.com \
--cc=penberg@cs.helsinki.fi \
/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