All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mm, slab: Drop unnecessary slabp->inuse < cachep->num test
@ 2013-07-01 16:29 ` Zhang Yanfei
  0 siblings, 0 replies; 6+ messages in thread
From: Zhang Yanfei @ 2013-07-01 16:29 UTC (permalink / raw)
  To: penberg, cl, mpm; +Cc: Linux MM, linux-kernel, Zhang Yanfei

From: Zhang Yanfei <zhangyanfei@cn.fujitsu.com>

In function cache_alloc_refill, we have used BUG_ON to ensure
that slabp->inuse is less than cachep->num before the while
test. And in the while body, we do not change the value of
slabp->inuse and cachep->num, so it is not necessary to test
if slabp->inuse < cachep->num test for every loop.

Signed-off-by: Zhang Yanfei <zhangyanfei@cn.fujitsu.com>
---
 mm/slab.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/mm/slab.c b/mm/slab.c
index 8ccd296..c2076c2 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -3004,7 +3004,7 @@ retry:
 		 */
 		BUG_ON(slabp->inuse >= cachep->num);
 
-		while (slabp->inuse < cachep->num && batchcount--) {
+		while (batchcount--) {
 			STATS_INC_ALLOCED(cachep);
 			STATS_INC_ACTIVE(cachep);
 			STATS_SET_HIGH(cachep);
-- 
1.7.1

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

* [PATCH] mm, slab: Drop unnecessary slabp->inuse < cachep->num test
@ 2013-07-01 16:29 ` Zhang Yanfei
  0 siblings, 0 replies; 6+ messages in thread
From: Zhang Yanfei @ 2013-07-01 16:29 UTC (permalink / raw)
  To: penberg, cl, mpm; +Cc: Linux MM, linux-kernel, Zhang Yanfei

From: Zhang Yanfei <zhangyanfei@cn.fujitsu.com>

In function cache_alloc_refill, we have used BUG_ON to ensure
that slabp->inuse is less than cachep->num before the while
test. And in the while body, we do not change the value of
slabp->inuse and cachep->num, so it is not necessary to test
if slabp->inuse < cachep->num test for every loop.

Signed-off-by: Zhang Yanfei <zhangyanfei@cn.fujitsu.com>
---
 mm/slab.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/mm/slab.c b/mm/slab.c
index 8ccd296..c2076c2 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -3004,7 +3004,7 @@ retry:
 		 */
 		BUG_ON(slabp->inuse >= cachep->num);
 
-		while (slabp->inuse < cachep->num && batchcount--) {
+		while (batchcount--) {
 			STATS_INC_ALLOCED(cachep);
 			STATS_INC_ACTIVE(cachep);
 			STATS_SET_HIGH(cachep);
-- 
1.7.1

--
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/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: [PATCH] mm, slab: Drop unnecessary slabp->inuse < cachep->num test
  2013-07-01 16:29 ` Zhang Yanfei
@ 2013-07-01 16:36   ` Zhang Yanfei
  -1 siblings, 0 replies; 6+ messages in thread
From: Zhang Yanfei @ 2013-07-01 16:36 UTC (permalink / raw)
  To: penberg, cl, mpm; +Cc: Linux MM, linux-kernel, Zhang Yanfei

Sorry for making noise. I've made a mistake and please ignore this patch.

On 07/02/2013 12:29 AM, Zhang Yanfei wrote:
> From: Zhang Yanfei <zhangyanfei@cn.fujitsu.com>
> 
> In function cache_alloc_refill, we have used BUG_ON to ensure
> that slabp->inuse is less than cachep->num before the while
> test. And in the while body, we do not change the value of
> slabp->inuse and cachep->num, so it is not necessary to test
> if slabp->inuse < cachep->num test for every loop.
> 
> Signed-off-by: Zhang Yanfei <zhangyanfei@cn.fujitsu.com>
> ---
>  mm/slab.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/mm/slab.c b/mm/slab.c
> index 8ccd296..c2076c2 100644
> --- a/mm/slab.c
> +++ b/mm/slab.c
> @@ -3004,7 +3004,7 @@ retry:
>  		 */
>  		BUG_ON(slabp->inuse >= cachep->num);
>  
> -		while (slabp->inuse < cachep->num && batchcount--) {
> +		while (batchcount--) {
>  			STATS_INC_ALLOCED(cachep);
>  			STATS_INC_ACTIVE(cachep);
>  			STATS_SET_HIGH(cachep);


-- 
Thanks.
Zhang Yanfei

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

* Re: [PATCH] mm, slab: Drop unnecessary slabp->inuse < cachep->num test
@ 2013-07-01 16:36   ` Zhang Yanfei
  0 siblings, 0 replies; 6+ messages in thread
From: Zhang Yanfei @ 2013-07-01 16:36 UTC (permalink / raw)
  To: penberg, cl, mpm; +Cc: Linux MM, linux-kernel, Zhang Yanfei

Sorry for making noise. I've made a mistake and please ignore this patch.

On 07/02/2013 12:29 AM, Zhang Yanfei wrote:
> From: Zhang Yanfei <zhangyanfei@cn.fujitsu.com>
> 
> In function cache_alloc_refill, we have used BUG_ON to ensure
> that slabp->inuse is less than cachep->num before the while
> test. And in the while body, we do not change the value of
> slabp->inuse and cachep->num, so it is not necessary to test
> if slabp->inuse < cachep->num test for every loop.
> 
> Signed-off-by: Zhang Yanfei <zhangyanfei@cn.fujitsu.com>
> ---
>  mm/slab.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/mm/slab.c b/mm/slab.c
> index 8ccd296..c2076c2 100644
> --- a/mm/slab.c
> +++ b/mm/slab.c
> @@ -3004,7 +3004,7 @@ retry:
>  		 */
>  		BUG_ON(slabp->inuse >= cachep->num);
>  
> -		while (slabp->inuse < cachep->num && batchcount--) {
> +		while (batchcount--) {
>  			STATS_INC_ALLOCED(cachep);
>  			STATS_INC_ACTIVE(cachep);
>  			STATS_SET_HIGH(cachep);


-- 
Thanks.
Zhang Yanfei

--
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/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: [PATCH] mm, slab: Drop unnecessary slabp->inuse < cachep->num test
  2013-07-01 16:29 ` Zhang Yanfei
@ 2013-07-01 18:19   ` Christoph Lameter
  -1 siblings, 0 replies; 6+ messages in thread
From: Christoph Lameter @ 2013-07-01 18:19 UTC (permalink / raw)
  To: Zhang Yanfei; +Cc: penberg, mpm, Linux MM, linux-kernel, Zhang Yanfei

On Tue, 2 Jul 2013, Zhang Yanfei wrote:

> From: Zhang Yanfei <zhangyanfei@cn.fujitsu.com>
>
> In function cache_alloc_refill, we have used BUG_ON to ensure
> that slabp->inuse is less than cachep->num before the while
> test. And in the while body, we do not change the value of
> slabp->inuse and cachep->num, so it is not necessary to test
> if slabp->inuse < cachep->num test for every loop.

The body calls slab_get_obj which changes slabp->inuse!

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

* Re: [PATCH] mm, slab: Drop unnecessary slabp->inuse < cachep->num test
@ 2013-07-01 18:19   ` Christoph Lameter
  0 siblings, 0 replies; 6+ messages in thread
From: Christoph Lameter @ 2013-07-01 18:19 UTC (permalink / raw)
  To: Zhang Yanfei; +Cc: penberg, mpm, Linux MM, linux-kernel, Zhang Yanfei

On Tue, 2 Jul 2013, Zhang Yanfei wrote:

> From: Zhang Yanfei <zhangyanfei@cn.fujitsu.com>
>
> In function cache_alloc_refill, we have used BUG_ON to ensure
> that slabp->inuse is less than cachep->num before the while
> test. And in the while body, we do not change the value of
> slabp->inuse and cachep->num, so it is not necessary to test
> if slabp->inuse < cachep->num test for every loop.

The body calls slab_get_obj which changes slabp->inuse!

--
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/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

end of thread, other threads:[~2013-07-01 18:19 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-01 16:29 [PATCH] mm, slab: Drop unnecessary slabp->inuse < cachep->num test Zhang Yanfei
2013-07-01 16:29 ` Zhang Yanfei
2013-07-01 16:36 ` Zhang Yanfei
2013-07-01 16:36   ` Zhang Yanfei
2013-07-01 18:19 ` Christoph Lameter
2013-07-01 18:19   ` Christoph Lameter

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.