lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 23 Aug 2011 09:48:18 +0800
From:	Shaohua Li <shaohua.li@...el.com>
To:	Andrew Morton <akpm@...ux-foundation.org>
Cc:	linux-mm <linux-mm@...ck.org>, lkml <linux-kernel@...r.kernel.org>,
	cl@...ux.com, penberg@...nel.org, "Shi, Alex" <alex.shi@...el.com>,
	"Chen, Tim C" <tim.c.chen@...el.com>
Subject: Re: [patch 1/2]slub: add slab with one free object to partial list
 tail

On Tue, 2011-08-23 at 08:36 +0800, Shaohua Li wrote:
> The slab has just one free object, adding it to partial list head doesn't make
> sense. And it can cause lock contentation. For example,
> 1. CPU takes the slab from partial list
> 2. fetch an object
> 3. switch to another slab
> 4. free an object, then the slab is added to partial list again
> In this way n->list_lock will be heavily contended.
> In fact, Alex had a hackbench regression. 3.1-rc1 performance drops about 70%
> against 3.0. This patch fixes it.
updated the change log a little bit. My apologize to not mention Alex's credit.

Thanks,
Shaohua


The slab has just one free object, adding it to partial list head doesn't make
sense. And it can cause lock contentation. For example,
1. CPU takes the slab from partial list
2. fetch an object
3. switch to another slab
4. free an object, then the slab is added to partial list again
In this way n->list_lock will be heavily contended.
In fact, Alex had a hackbench regression. 3.1-rc1 performance drops about 70%
against 3.0. This patch fixes it. Thanks Alex to bisect the issue to be a slub
regression and collect perf data.

Reported-by: Alex Shi <alex.shi@...el.com>
Signed-off-by: Shaohua Li <shli@...nel.org>
Signed-off-by: Shaohua Li <shaohua.li@...el.com>

---
 mm/slub.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux/mm/slub.c
===================================================================
--- linux.orig/mm/slub.c	2011-08-15 09:55:21.000000000 +0800
+++ linux/mm/slub.c	2011-08-23 08:13:54.000000000 +0800
@@ -2377,7 +2377,7 @@ static void __slab_free(struct kmem_cach
 		 */
 		if (unlikely(!prior)) {
 			remove_full(s, page);
-			add_partial(n, page, 0);
+			add_partial(n, page, 1);
 			stat(s, FREE_ADD_PARTIAL);
 		}
 	}


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ