All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch 2/2]slub: explicitly document position of inserting slab to partial list
@ 2011-08-30  1:54 Shaohua Li
  2011-08-30 13:48 ` Christoph Lameter
  0 siblings, 1 reply; 3+ messages in thread
From: Shaohua Li @ 2011-08-30  1:54 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Christoph Lameter, penberg, Shi, Alex, Chen, Tim C, linux-mm

Adding slab to partial list head/tail is sensitive to performance. Using 0/1
can easily cause typo. So explicitly uses DEACTIVATE_TO_TAIL/DEACTIVATE_TO_HEAD
to document it to avoid we get it wrong.

Signed-off-by: Shaohua Li <shli@kernel.org>
Signed-off-by: Shaohua Li <shaohua.li@intel.com>
Acked-by: Christoph Lameter <cl@linux.com>
---
 mm/slub.c |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

Index: linux/mm/slub.c
===================================================================
--- linux.orig/mm/slub.c	2011-08-30 09:45:03.000000000 +0800
+++ linux/mm/slub.c	2011-08-30 09:45:45.000000000 +0800
@@ -1534,7 +1534,7 @@ static inline void add_partial(struct km
 				struct page *page, int tail)
 {
 	n->nr_partial++;
-	if (tail)
+	if (tail == DEACTIVATE_TO_TAIL)
 		list_add_tail(&page->lru, &n->partial);
 	else
 		list_add(&page->lru, &n->partial);
@@ -1781,13 +1781,13 @@ static void deactivate_slab(struct kmem_
 	enum slab_modes l = M_NONE, m = M_NONE;
 	void *freelist;
 	void *nextfree;
-	int tail = 0;
+	int tail = DEACTIVATE_TO_HEAD;
 	struct page new;
 	struct page old;
 
 	if (page->freelist) {
 		stat(s, DEACTIVATE_REMOTE_FREES);
-		tail = 1;
+		tail = DEACTIVATE_TO_TAIL;
 	}
 
 	c->tid = next_tid(c->tid);
@@ -1893,7 +1893,7 @@ redo:
 		if (m == M_PARTIAL) {
 
 			add_partial(n, page, tail);
-			stat(s, tail ? DEACTIVATE_TO_TAIL : DEACTIVATE_TO_HEAD);
+			stat(s, tail);
 
 		} else if (m == M_FULL) {
 
@@ -2382,7 +2382,7 @@ static void __slab_free(struct kmem_cach
 			 * partial list tail so it will not be used
 			 * immediately.
 			 */
-			add_partial(n, page, 1);
+			add_partial(n, page, DEACTIVATE_TO_TAIL);
 			stat(s, FREE_ADD_PARTIAL);
 		}
 	}
@@ -2700,7 +2700,7 @@ static void early_kmem_cache_node_alloc(
 	init_kmem_cache_node(n, kmem_cache_node);
 	inc_slabs_node(kmem_cache_node, node, page->objects);
 
-	add_partial(n, page, 0);
+	add_partial(n, page, DEACTIVATE_TO_HEAD);
 }
 
 static void free_kmem_cache_nodes(struct kmem_cache *s)


--
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/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [patch 2/2]slub: explicitly document position of inserting slab to partial list
  2011-08-30  1:54 [patch 2/2]slub: explicitly document position of inserting slab to partial list Shaohua Li
@ 2011-08-30 13:48 ` Christoph Lameter
  2011-08-31  2:29   ` Shaohua Li
  0 siblings, 1 reply; 3+ messages in thread
From: Christoph Lameter @ 2011-08-30 13:48 UTC (permalink / raw)
  To: Shaohua Li; +Cc: Andrew Morton, penberg, Shi, Alex, Chen, Tim C, linux-mm

On Tue, 30 Aug 2011, Shaohua Li wrote:

> Adding slab to partial list head/tail is sensitive to performance. Using 0/1
> can easily cause typo. So explicitly uses DEACTIVATE_TO_TAIL/DEACTIVATE_TO_HEAD
> to document it to avoid we get it wrong.

I dont think we want this patch anymore.

--
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/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [patch 2/2]slub: explicitly document position of inserting slab to partial list
  2011-08-30 13:48 ` Christoph Lameter
@ 2011-08-31  2:29   ` Shaohua Li
  0 siblings, 0 replies; 3+ messages in thread
From: Shaohua Li @ 2011-08-31  2:29 UTC (permalink / raw)
  To: Christoph Lameter
  Cc: Andrew Morton, penberg, Shi, Alex, Chen, Tim C, linux-mm

On Tue, 2011-08-30 at 21:48 +0800, Christoph Lameter wrote:
> On Tue, 30 Aug 2011, Shaohua Li wrote:
> 
> > Adding slab to partial list head/tail is sensitive to performance. Using 0/1
> > can easily cause typo. So explicitly uses DEACTIVATE_TO_TAIL/DEACTIVATE_TO_HEAD
> > to document it to avoid we get it wrong.
> 
> I dont think we want this patch anymore.
I do think using 0/1 isn't good. A more meaningful name is better to
avoid typo.

--
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/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-08-31  2:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-30  1:54 [patch 2/2]slub: explicitly document position of inserting slab to partial list Shaohua Li
2011-08-30 13:48 ` Christoph Lameter
2011-08-31  2:29   ` Shaohua Li

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.