linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Manfred Spraul <manfred@colorfullife.com>
To: Andrew Morton <akpm@digeo.com>
Cc: Ed Tomlinson <tomlins@cam.org>, linux-kernel@vger.kernel.org
Subject: Re: [patch 3/4] slab reclaim balancing
Date: Fri, 27 Sep 2002 21:38:28 +0200	[thread overview]
Message-ID: <3D94B3B4.6090409@colorfullife.com> (raw)
In-Reply-To: 3D94A2D4.55721A8A@digeo.com

[-- Attachment #1: Type: text/plain, Size: 1275 bytes --]

Andrew Morton wrote:
> 
>>* After flushing a batch back into the lists, the number of free objects
>>in the lists is calculated. If freeable pages exist and the number
>>exceeds a target, then the freeable pages above the target are returned
>>to the page buddy.
> 
> 
> Probably OK for now.  But slab should _not_ hold onto an unused,
> cache-warm page.  Because do_anonymous_page() may want one.
> 
If the per-cpu caches are enabled on UP, too, then this is a moot point: 
by the time a batch is freed from the per-cpu array, it will be cache cold.
And btw, why do you think a page is cache-warm when the last object on a 
  page is freed? If the last 32-byte kmalloc is released on a page, 40xx 
bytes are probably cache-cold.

Back to your first problem: You've mentioned excess hits on the 
cache_chain_semaphore. Which app did you use for stress testing? Could 
you run a stress test with the applied patch?

I've tried dbench 50, with 128 MB RAM, on uniprocessor, with 2.4:

There were 9100 calls to kmem_cache_reap, and in 90% of the calls, no 
freeable memory was found. Alltogether, only 1300 pages were freed from 
the slabs.

Are there just too many calls to kmem_cache_reap()? Perhaps we should 
try to optimize the "nothing freeable exists" logic?

--
	Manfred

[-- Attachment #2: patch-slab-stat --]
[-- Type: text/plain, Size: 926 bytes --]

--- 2.4/mm/slab.c	Fri Aug 30 18:39:22 2002
+++ build-2.4/mm/slab.c	Fri Sep 27 21:01:31 2002
@@ -1727,6 +1735,9 @@
 }
 #endif
 
+unsigned long g_calls = 0;
+unsigned long g_pages = 0;
+unsigned long g_success = 0;
 /**
  * kmem_cache_reap - Reclaim memory from caches.
  * @gfp_mask: the type of memory required.
@@ -1749,6 +1760,7 @@
 		if (down_trylock(&cache_chain_sem))
 			return 0;
 
+g_calls++;
 	scan = REAP_SCANLEN;
 	best_len = 0;
 	best_pages = 0;
@@ -1827,6 +1839,8 @@
 perfect:
 	/* free only 50% of the free slabs */
 	best_len = (best_len + 1)/2;
+g_success++;
+g_pages+=best_len;
 	for (scan = 0; scan < best_len; scan++) {
 		struct list_head *p;
 
@@ -1907,6 +1921,7 @@
 		 * Output format version, so at least we can change it
 		 * without _too_ many complaints.
 		 */
+		seq_printf(m, "%lu %lu %lu.\n",g_calls, g_pages, g_success);
 		seq_puts(m, "slabinfo - version: 1.1"
 #if STATS
 				" (statistics)"

  reply	other threads:[~2002-09-27 19:33 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-09-26 14:13 [patch 3/4] slab reclaim balancing Manfred Spraul
2002-09-26 14:20 ` William Lee Irwin III
2002-09-26 15:24   ` Manfred Spraul
2002-09-26 17:37 ` Andrew Morton
2002-09-26 18:47   ` Manfred Spraul
2002-09-26 19:49     ` Andrew Morton
2002-09-26 20:49       ` Manfred Spraul
2002-09-26 21:39         ` Andrew Morton
2002-09-27  0:41           ` Ed Tomlinson
2002-09-27 17:24             ` Manfred Spraul
2002-09-27 18:26               ` Andrew Morton
2002-09-27 19:38                 ` Manfred Spraul [this message]
2002-09-27 19:52                   ` Andrew Morton
2002-09-27 15:59           ` Manfred Spraul
  -- strict thread matches above, loose matches on Subject: below --
2002-09-26  4:08 Andrew Morton
2002-09-26 11:39 ` Ed Tomlinson
2002-09-26 15:09 ` Ed Tomlinson

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=3D94B3B4.6090409@colorfullife.com \
    --to=manfred@colorfullife.com \
    --cc=akpm@digeo.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tomlins@cam.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;
as well as URLs for NNTP newsgroup(s).