lkml.org 
[lkml]   [2013]   [Apr]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
SubjectRe: [RT LATENCY] 249 microsecond latency caused by slub's unfreeze_partials() code.
From
Date
Sorry for the late reply, but I just got back from vacation.

On Thu, 2013-03-28 at 17:29 +0000, Christoph Lameter wrote:
> Two patches against slub to enable deconfiguring cpu_partial support.
>
> First one is a bug fix (Pekka please pick up this one or use Joonsoo's
> earlier one).
>
>
> Subject: slub: Fix object counts in acquire_slab
>
> It seems that we were overallocating objects from the slab queues
> since get_partial_node() assumed that page->inuse was undisturbed by
> acquire_slab(). Save the # of objects in page->lru.next in acquire_slab()
> and pass it to get_partial_node() that way.
>
> I have a vague memory that Joonsoo also ran into this issue awhile back.
>
> Signed-off-by: Christoph Lameter <cl@linux.com>
>
> Index: linux/mm/slub.c
> ===================================================================
> --- linux.orig/mm/slub.c 2013-03-28 12:14:26.958358688 -0500
> +++ linux/mm/slub.c 2013-03-28 12:16:57.240785613 -0500
> @@ -1498,6 +1498,7 @@ static inline void *acquire_slab(struct
> void *freelist;
> unsigned long counters;
> struct page new;
> + unsigned long objects;
>
> /*
> * Zap the freelist and set the frozen bit.
> @@ -1507,6 +1508,7 @@ static inline void *acquire_slab(struct
> freelist = page->freelist;
> counters = page->counters;
> new.counters = counters;
> + objects = page->objects;
> if (mode) {
> new.inuse = page->objects;
> new.freelist = NULL;
> @@ -1524,6 +1526,7 @@ static inline void *acquire_slab(struct
> return NULL;
>
> remove_partial(n, page);
> + page->lru.next = (void *)objects;
> WARN_ON(!freelist);
> return freelist;
> }
> @@ -1565,7 +1568,7 @@ static void *get_partial_node(struct kme
> c->page = page;
> stat(s, ALLOC_FROM_PARTIAL);
> object = t;
> - available = page->objects - page->inuse;
> + available = page->objects - (unsigned long)page->lru.next;

Ug, this is a really nasty hack. To avoid the curses you will get by the
one that takes over this code when you retire, I suggest just have
"objects" passed back as a reference parameter. I only see
acquire_slab() used here. Why not just pass in a pointer and have that
assigned objects instead of using a error prone use of lru.next?

-- Steve

> } else {
> available = put_cpu_partial(s, page, 0);
> stat(s, CPU_PARTIAL_NODE);



\
 
 \ /
  Last update: 2013-04-08 15:21    [W:0.230 / U:0.372 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site