All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mm/zsmalloc: avoid unnecessary iteration when freeing size_class
@ 2015-01-24 13:50 ` Ganesh Mahendran
  0 siblings, 0 replies; 8+ messages in thread
From: Ganesh Mahendran @ 2015-01-24 13:50 UTC (permalink / raw)
  To: minchan, ngupta; +Cc: akpm, linux-mm, linux-kernel, Ganesh Mahendran

The pool->size_class[i] is assigned with the i from (zs_size_classes - 1) to 0.
So if we failed in zs_create_pool(), we only need to iterate from (zs_size_classes - 1)
to i, instead of from 0 to (zs_size_classes - 1)

Signed-off-by: Ganesh Mahendran <opensource.ganesh@gmail.com>
Cc: Nitin Gupta <ngupta@vflare.org>
Cc: Minchan Kim <minchan@kernel.org>
---
 mm/zsmalloc.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c
index 16617e9..e6fa3da 100644
--- a/mm/zsmalloc.c
+++ b/mm/zsmalloc.c
@@ -1433,12 +1433,12 @@ void zs_destroy_pool(struct zs_pool *pool)
 
 	zs_pool_stat_destroy(pool);
 
-	for (i = 0; i < zs_size_classes; i++) {
+	for (i = zs_size_classes - 1; i >= 0; i--) {
 		int fg;
 		struct size_class *class = pool->size_class[i];
 
 		if (!class)
-			continue;
+			break;
 
 		if (class->index != i)
 			continue;
-- 
1.7.9.5


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

* [PATCH] mm/zsmalloc: avoid unnecessary iteration when freeing size_class
@ 2015-01-24 13:50 ` Ganesh Mahendran
  0 siblings, 0 replies; 8+ messages in thread
From: Ganesh Mahendran @ 2015-01-24 13:50 UTC (permalink / raw)
  To: minchan, ngupta; +Cc: akpm, linux-mm, linux-kernel, Ganesh Mahendran

The pool->size_class[i] is assigned with the i from (zs_size_classes - 1) to 0.
So if we failed in zs_create_pool(), we only need to iterate from (zs_size_classes - 1)
to i, instead of from 0 to (zs_size_classes - 1)

Signed-off-by: Ganesh Mahendran <opensource.ganesh@gmail.com>
Cc: Nitin Gupta <ngupta@vflare.org>
Cc: Minchan Kim <minchan@kernel.org>
---
 mm/zsmalloc.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c
index 16617e9..e6fa3da 100644
--- a/mm/zsmalloc.c
+++ b/mm/zsmalloc.c
@@ -1433,12 +1433,12 @@ void zs_destroy_pool(struct zs_pool *pool)
 
 	zs_pool_stat_destroy(pool);
 
-	for (i = 0; i < zs_size_classes; i++) {
+	for (i = zs_size_classes - 1; i >= 0; i--) {
 		int fg;
 		struct size_class *class = pool->size_class[i];
 
 		if (!class)
-			continue;
+			break;
 
 		if (class->index != i)
 			continue;
-- 
1.7.9.5

--
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] 8+ messages in thread

* Re: [PATCH] mm/zsmalloc: avoid unnecessary iteration when freeing size_class
  2015-01-24 13:50 ` Ganesh Mahendran
@ 2015-01-31  8:59   ` Ganesh Mahendran
  -1 siblings, 0 replies; 8+ messages in thread
From: Ganesh Mahendran @ 2015-01-31  8:59 UTC (permalink / raw)
  To: Minchan Kim, Nitin Gupta
  Cc: Andrew Morton, Linux-MM, linux-kernel, Ganesh Mahendran

ping.

2015-01-24 21:50 GMT+08:00 Ganesh Mahendran <opensource.ganesh@gmail.com>:
> The pool->size_class[i] is assigned with the i from (zs_size_classes - 1) to 0.
> So if we failed in zs_create_pool(), we only need to iterate from (zs_size_classes - 1)
> to i, instead of from 0 to (zs_size_classes - 1)

No functionality has been changed. This patch just avoids some
necessary iteration.

Thanks.

>
> Signed-off-by: Ganesh Mahendran <opensource.ganesh@gmail.com>
> Cc: Nitin Gupta <ngupta@vflare.org>
> Cc: Minchan Kim <minchan@kernel.org>
> ---
>  mm/zsmalloc.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c
> index 16617e9..e6fa3da 100644
> --- a/mm/zsmalloc.c
> +++ b/mm/zsmalloc.c
> @@ -1433,12 +1433,12 @@ void zs_destroy_pool(struct zs_pool *pool)
>
>         zs_pool_stat_destroy(pool);
>
> -       for (i = 0; i < zs_size_classes; i++) {
> +       for (i = zs_size_classes - 1; i >= 0; i--) {
>                 int fg;
>                 struct size_class *class = pool->size_class[i];
>
>                 if (!class)
> -                       continue;
> +                       break;
>
>                 if (class->index != i)
>                         continue;
> --
> 1.7.9.5
>

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

* Re: [PATCH] mm/zsmalloc: avoid unnecessary iteration when freeing size_class
@ 2015-01-31  8:59   ` Ganesh Mahendran
  0 siblings, 0 replies; 8+ messages in thread
From: Ganesh Mahendran @ 2015-01-31  8:59 UTC (permalink / raw)
  To: Minchan Kim, Nitin Gupta
  Cc: Andrew Morton, Linux-MM, linux-kernel, Ganesh Mahendran

ping.

2015-01-24 21:50 GMT+08:00 Ganesh Mahendran <opensource.ganesh@gmail.com>:
> The pool->size_class[i] is assigned with the i from (zs_size_classes - 1) to 0.
> So if we failed in zs_create_pool(), we only need to iterate from (zs_size_classes - 1)
> to i, instead of from 0 to (zs_size_classes - 1)

No functionality has been changed. This patch just avoids some
necessary iteration.

Thanks.

>
> Signed-off-by: Ganesh Mahendran <opensource.ganesh@gmail.com>
> Cc: Nitin Gupta <ngupta@vflare.org>
> Cc: Minchan Kim <minchan@kernel.org>
> ---
>  mm/zsmalloc.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c
> index 16617e9..e6fa3da 100644
> --- a/mm/zsmalloc.c
> +++ b/mm/zsmalloc.c
> @@ -1433,12 +1433,12 @@ void zs_destroy_pool(struct zs_pool *pool)
>
>         zs_pool_stat_destroy(pool);
>
> -       for (i = 0; i < zs_size_classes; i++) {
> +       for (i = zs_size_classes - 1; i >= 0; i--) {
>                 int fg;
>                 struct size_class *class = pool->size_class[i];
>
>                 if (!class)
> -                       continue;
> +                       break;
>
>                 if (class->index != i)
>                         continue;
> --
> 1.7.9.5
>

--
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] 8+ messages in thread

* Re: [PATCH] mm/zsmalloc: avoid unnecessary iteration when freeing size_class
  2015-01-31  8:59   ` Ganesh Mahendran
@ 2015-02-02  1:09     ` Minchan Kim
  -1 siblings, 0 replies; 8+ messages in thread
From: Minchan Kim @ 2015-02-02  1:09 UTC (permalink / raw)
  To: Ganesh Mahendran; +Cc: Nitin Gupta, Andrew Morton, Linux-MM, linux-kernel

Hello Ganesh,

On Sat, Jan 31, 2015 at 04:59:58PM +0800, Ganesh Mahendran wrote:
> ping.
> 
> 2015-01-24 21:50 GMT+08:00 Ganesh Mahendran <opensource.ganesh@gmail.com>:
> > The pool->size_class[i] is assigned with the i from (zs_size_classes - 1) to 0.
> > So if we failed in zs_create_pool(), we only need to iterate from (zs_size_classes - 1)
> > to i, instead of from 0 to (zs_size_classes - 1)
> 
> No functionality has been changed. This patch just avoids some
> necessary iteration.

Sorry for the delay. Did you saw any performance problem?
I know it would be better than old but your assumption depends on the
implmentation of zs_create_pool so if we changes(for example,
revert 9eec4cd if compaction works well), your patch would be void.
If it's not a critical, I'd like to remain it as generic and doesn't
contaminate git-blame.

Thanks.

-- 
Kind regards,
Minchan Kim

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

* Re: [PATCH] mm/zsmalloc: avoid unnecessary iteration when freeing size_class
@ 2015-02-02  1:09     ` Minchan Kim
  0 siblings, 0 replies; 8+ messages in thread
From: Minchan Kim @ 2015-02-02  1:09 UTC (permalink / raw)
  To: Ganesh Mahendran; +Cc: Nitin Gupta, Andrew Morton, Linux-MM, linux-kernel

Hello Ganesh,

On Sat, Jan 31, 2015 at 04:59:58PM +0800, Ganesh Mahendran wrote:
> ping.
> 
> 2015-01-24 21:50 GMT+08:00 Ganesh Mahendran <opensource.ganesh@gmail.com>:
> > The pool->size_class[i] is assigned with the i from (zs_size_classes - 1) to 0.
> > So if we failed in zs_create_pool(), we only need to iterate from (zs_size_classes - 1)
> > to i, instead of from 0 to (zs_size_classes - 1)
> 
> No functionality has been changed. This patch just avoids some
> necessary iteration.

Sorry for the delay. Did you saw any performance problem?
I know it would be better than old but your assumption depends on the
implmentation of zs_create_pool so if we changes(for example,
revert 9eec4cd if compaction works well), your patch would be void.
If it's not a critical, I'd like to remain it as generic and doesn't
contaminate git-blame.

Thanks.

-- 
Kind regards,
Minchan Kim

--
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] 8+ messages in thread

* Re: [PATCH] mm/zsmalloc: avoid unnecessary iteration when freeing size_class
  2015-02-02  1:09     ` Minchan Kim
@ 2015-02-02 12:09       ` Ganesh Mahendran
  -1 siblings, 0 replies; 8+ messages in thread
From: Ganesh Mahendran @ 2015-02-02 12:09 UTC (permalink / raw)
  To: Minchan Kim; +Cc: Nitin Gupta, Andrew Morton, Linux-MM, linux-kernel

Hello Minchan:

2015-02-02 9:09 GMT+08:00 Minchan Kim <minchan@kernel.org>:
> Hello Ganesh,
>
> On Sat, Jan 31, 2015 at 04:59:58PM +0800, Ganesh Mahendran wrote:
>> ping.
>>
>> 2015-01-24 21:50 GMT+08:00 Ganesh Mahendran <opensource.ganesh@gmail.com>:
>> > The pool->size_class[i] is assigned with the i from (zs_size_classes - 1) to 0.
>> > So if we failed in zs_create_pool(), we only need to iterate from (zs_size_classes - 1)
>> > to i, instead of from 0 to (zs_size_classes - 1)
>>
>> No functionality has been changed. This patch just avoids some
>> necessary iteration.
>
> Sorry for the delay. Did you saw any performance problem?
> I know it would be better than old but your assumption depends on the
> implmentation of zs_create_pool so if we changes(for example,
> revert 9eec4cd if compaction works well), your patch would be void.

Yes, You are right.
Thanks so much.

> If it's not a critical, I'd like to remain it as generic and doesn't
> contaminate git-blame.
>
> Thanks.
>
> --
> Kind regards,
> Minchan Kim

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

* Re: [PATCH] mm/zsmalloc: avoid unnecessary iteration when freeing size_class
@ 2015-02-02 12:09       ` Ganesh Mahendran
  0 siblings, 0 replies; 8+ messages in thread
From: Ganesh Mahendran @ 2015-02-02 12:09 UTC (permalink / raw)
  To: Minchan Kim; +Cc: Nitin Gupta, Andrew Morton, Linux-MM, linux-kernel

Hello Minchan:

2015-02-02 9:09 GMT+08:00 Minchan Kim <minchan@kernel.org>:
> Hello Ganesh,
>
> On Sat, Jan 31, 2015 at 04:59:58PM +0800, Ganesh Mahendran wrote:
>> ping.
>>
>> 2015-01-24 21:50 GMT+08:00 Ganesh Mahendran <opensource.ganesh@gmail.com>:
>> > The pool->size_class[i] is assigned with the i from (zs_size_classes - 1) to 0.
>> > So if we failed in zs_create_pool(), we only need to iterate from (zs_size_classes - 1)
>> > to i, instead of from 0 to (zs_size_classes - 1)
>>
>> No functionality has been changed. This patch just avoids some
>> necessary iteration.
>
> Sorry for the delay. Did you saw any performance problem?
> I know it would be better than old but your assumption depends on the
> implmentation of zs_create_pool so if we changes(for example,
> revert 9eec4cd if compaction works well), your patch would be void.

Yes, You are right.
Thanks so much.

> If it's not a critical, I'd like to remain it as generic and doesn't
> contaminate git-blame.
>
> Thanks.
>
> --
> Kind regards,
> Minchan Kim

--
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] 8+ messages in thread

end of thread, other threads:[~2015-02-02 12:09 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-24 13:50 [PATCH] mm/zsmalloc: avoid unnecessary iteration when freeing size_class Ganesh Mahendran
2015-01-24 13:50 ` Ganesh Mahendran
2015-01-31  8:59 ` Ganesh Mahendran
2015-01-31  8:59   ` Ganesh Mahendran
2015-02-02  1:09   ` Minchan Kim
2015-02-02  1:09     ` Minchan Kim
2015-02-02 12:09     ` Ganesh Mahendran
2015-02-02 12:09       ` Ganesh Mahendran

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.