Skip to contentSkip to conversation

slub: remove a minus instruction in get_partial_node

PATCH In review Alex,Shi 2 participants 7 messages Sep 29, 2011 – Oct 11, 2011

Subsystems (2)
lore
Share & tools
lore

Alex,Shi

author
#0 lore raw

PATCH 1/1 slub: remove a minus instruction in get_partial_node

Don't do a minus action in get_partial_node function here, since it is always zero.

---
 mm/slub.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
mm/slub.c +1 -2
index 492beab..eb36a6b 100644
@@ -1613,7 +1613,7 @@ static void *get_partial_node(struct kmem_cache *s,
 	spin_lock(&n->list_lock);
 	list_for_each_entry_safe(page, page2, &n->partial, lru) {
 		void *t = acquire_slab(s, n, page, object == NULL);
-		int available;
+		int available = 0;
 
 		if (!t)
 			continue;
@@ -1623,7 +1623,6 @@ static void *get_partial_node(struct kmem_cache *s,
 			c->node = page_to_nid(page);
 			stat(s, ALLOC_FROM_PARTIAL);
 			object = t;
-			available =  page->objects - page->inuse;
 		} else {
 			page->freelist = t;
 			available = put_cpu_partial(s, page, 0);
Signature · 10 lines
1.7.0



--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  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:"[email protected]"> [email protected] </a>
#1 lore raw
Quoted 2 lines · Alex,Shi

Don't do a minus action in get_partial_node function here, since it is always zero.

A slab on the partial lists always has objects available. Why would it be zero?

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected]. 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:"[email protected]"> [email protected] </a>

author
#2 lore raw
Quoted 9 lines

-----Original Message-----
From: Christoph Lameter [mailto:[email protected]]
Sent: Thursday, September 29, 2011 10:19 PM
To: Shi, Alex
Cc: Pekka Enberg; [email protected]; Chen, Tim C; Huang, Ying
Subject: Re: [PATCH] slub: remove a minus instruction in get_partial_node

Quoted 7 lines
Quoted 2 lines · Alex,Shi

Don't do a minus action in get_partial_node function here, since it is always zero.

A slab on the partial lists always has objects available. Why would it be zero?

Um, my mistaken. The reason should be: if code is here, the slab will be per cpu slab. It is no chance to be in per cpu partial and no relationship with per cpu partial. So no reason to use this value as a criteria for filling per cpu partial.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected]. 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:"[email protected]"> [email protected] </a>

#3 lore raw
Quoted 6 lines · Alex
Quoted 2 lines

A slab on the partial lists always has objects available. Why would it be zero?

Um, my mistaken. The reason should be: if code is here, the slab will be per cpu slab. It is no chance to be in per cpu partial and no relationship with per cpu partial. So no reason to use this value as a criteria for filling per cpu partial.

I am not sure I understand you. The point of the code is to count the objects available in the per cpu partial pages so that we can limit the number of pages we fetch from the per node partial list.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected]. 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:"[email protected]"> [email protected] </a>

author
#4 lore raw
Quoted 5 lines · Christoph Lameter
Quoted 3 lines · Alex
Quoted 2 lines

A slab on the partial lists always has objects available. Why would it be zero?

Quoted 7 lines
Quoted 3 lines

Um, my mistaken. The reason should be: if code is here, the slab will be per cpu slab. It is no chance to be in per cpu partial and no relationship with per cpu partial. So no reason to use this value as a criteria for filling per cpu partial.

I am not sure I understand you. The point of the code is to count the objects available in the per cpu partial pages so that we can limit the number of pages we fetch from the per node partial list.

Maybe my understanding is incorrect for PCP. :)
What I thought is: when object == null, the page we got from node partial list will be added into cpu slab. It has no chance to become per cpu partial page. And it has no relationship with further per cpu partial count checking. Since even 'available > cpu_partial/2', it doesn't mean per cpu partial objects number > cpu_partial/2.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected]. 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:"[email protected]"> [email protected] </a>

#5 lore raw
Quoted 14 lines · Alex,Shi
Quoted 5 lines · Christoph Lameter
Quoted 3 lines · Alex
Quoted 2 lines

A slab on the partial lists always has objects available. Why would it be zero?

Quoted 7 lines
Quoted 3 lines

Um, my mistaken. The reason should be: if code is here, the slab will be per cpu slab. It is no chance to be in per cpu partial and no relationship with per cpu partial. So no reason to use this value as a criteria for filling per cpu partial.

I am not sure I understand you. The point of the code is to count the objects available in the per cpu partial pages so that we can limit the number of pages we fetch from the per node partial list.

Quoted 6 lines

Maybe my understanding is incorrect for PCP. :)
What I thought is: when object == null, the page we got from node partial list will be added into cpu slab. It has no chance to become per cpu partial page. And it has no relationship with further per cpu partial count checking. Since even 'available > cpu_partial/2', it doesn't mean per cpu partial objects number > cpu_partial/2.

acquire_slab should not return NULL unless something seriously goes wrong. I think we can remove the]

	if (!t)

statement to avoid futher confusion?

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected]. 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:"[email protected]"> [email protected] </a>

author
#6 lore raw
Quoted 23 lines · Christoph Lameter
Quoted 14 lines · Alex,Shi
Quoted 5 lines · Christoph Lameter
Quoted 3 lines · Alex
Quoted 2 lines

A slab on the partial lists always has objects available. Why would it be zero?

Quoted 7 lines
Quoted 3 lines

Um, my mistaken. The reason should be: if code is here, the slab will be per cpu slab. It is no chance to be in per cpu partial and no relationship with per cpu partial. So no reason to use this value as a criteria for filling per cpu partial.

I am not sure I understand you. The point of the code is to count the objects available in the per cpu partial pages so that we can limit the number of pages we fetch from the per node partial list.

Quoted 6 lines

Maybe my understanding is incorrect for PCP. :)
What I thought is: when object == null, the page we got from node partial list will be added into cpu slab. It has no chance to become per cpu partial page. And it has no relationship with further per cpu partial count checking. Since even 'available > cpu_partial/2', it doesn't mean per cpu partial objects number > cpu_partial/2.

Quoted 6 lines

acquire_slab should not return NULL unless something seriously goes wrong. I think we can remove the]

	if (!t)

statement to avoid futher confusion?

That is another story.

Wondering if a page freeing by discard_slab impact this or not. I don't fully understand the slub page alloc/free now, may study this later. :)

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected]. 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:"[email protected]"> [email protected] </a>