zswap: Adjustments for three function implementations
Subsystems (3)
cover zswap: Adjustments for three function implementations
From: Markus Elfring <[email protected]>
Date: Sun, 21 May 2017 10:20:03 +0200
Three update suggestions were taken into account
from static source code analysis.
Markus Elfring (3):
Delete an error message for a failed memory allocation in zswap_pool_create() Improve a size determination in zswap_frontswap_init()
Delete an error message for a failed memory allocation in zswap_dstmem_prepare()
mm/zswap.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-)
Signature · 1 line
2.13.0
PATCH 1/3 zswap: Delete an error message for a failed memory allocation in zswap_pool_create()
From: Markus Elfring <[email protected]>
Date: Sat, 20 May 2017 22:33:21 +0200
Omit an extra message for a memory allocation failure in this function.
This issue was detected by using the Coccinelle software.
--- mm/zswap.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
mm/zswap.c +1 -3
@@ -518,7 +518,5 @@ static struct zswap_pool *zswap_pool_create(char *type, char *compressor) -if (!pool) { -pr_err ("pool alloc failed\n" ); +if (!pool)return NULL ; - }/* unique name for each pool specifically required by zsmalloc */ snprintf (name,38 ,"zswap%x" ,atomic_inc_return (&zswap_pools_count));
Signature · 1 line
2.13.0
Re: [PATCH 1/3] zswap: Delete an error message for a failed memory allocation in zswap_pool_create()
Quoted 9 lines · SF Markus Elfring
From: Markus Elfring <[email protected]>
Date: Sat, 20 May 2017 22:33:21 +0200Omit an extra message for a memory allocation failure in this function.
This issue was detected by using the Coccinelle software.
Quoted 25 lines
--- mm/zswap.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)mm/zswap.c +1
-4@@ -518,7 +518,5 @@ static struct zswap_pool *zswap_pool_create(char *type, char *compressor) -if (!pool) { -pr_err ("pool alloc failed\n" ); +if (!pool)return NULL ; - }/* unique name for each pool specifically required by zsmalloc */ snprintf (name,38 ,"zswap%x" ,atomic_inc_return (&zswap_pools_count)); --2.13.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/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
PATCH 2/3 zswap: Improve a size determination in zswap_frontswap_init()
In reply to SF Markus ElfringFrom: Markus Elfring <[email protected]>
Date: Sat, 20 May 2017 22:44:03 +0200
Replace the specification of a data structure by a pointer dereference as the parameter for the operator "sizeof" to make the corresponding size determination a bit safer according to the Linux coding style convention.
--- mm/zswap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/zswap.c +1 -1
@@ -1156,5 +1156,5 @@ static void zswap_frontswap_init(unsigned type) {struct zswap_tree *tree; - tree =kzalloc (sizeof (struct zswap_tree ),GFP_KERNEL ); + tree =kzalloc (sizeof (*tree),GFP_KERNEL );if (!tree) {
Signature · 1 line
2.13.0
Re: [PATCH 2/3] zswap: Improve a size determination in zswap_frontswap_init()
Quoted 8 lines · SF Markus Elfring
From: Markus Elfring <[email protected]>
Date: Sat, 20 May 2017 22:44:03 +0200Replace the specification of a data structure by a pointer dereference as the parameter for the operator "sizeof" to make the corresponding size determination a bit safer according to the Linux coding style convention.
Signed-off-by Markus Elfring <[email protected]>
Quoted 18 lines
--- mm/zswap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)mm/zswap.c +1
-2@@ -1156,5 +1156,5 @@ static void zswap_frontswap_init(unsigned type) {struct zswap_tree *tree; - tree =kzalloc (sizeof (struct zswap_tree ),GFP_KERNEL ); + tree =kzalloc (sizeof (*tree),GFP_KERNEL );if (!tree) { --2.13.0
PATCH 3/3 zswap: Delete an error message for a failed memory allocation in zswap_dstmem_prepare()
In reply to SF Markus ElfringFrom: Markus Elfring <[email protected]>
Date: Sun, 21 May 2017 09:29:25 +0200
Omit an extra message for a memory allocation failure in this function.
This issue was detected by using the Coccinelle software.
--- mm/zswap.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
mm/zswap.c +2 -3
@@ -374,7 +374,6 @@ static int zswap_dstmem_prepare(unsigned int cpu) -if (!dst) { -pr_err ("can't allocate compressor buffer\n" ); +if (!dst)return -ENOMEM ; - } +per_cpu (zswap_dstmem, cpu) = dst;return 0 ; }
Signature · 1 line
2.13.0
Re: [PATCH 3/3] zswap: Delete an error message for a failed memory allocation in zswap_dstmem_prepare()
Markus, can you please stop CCing me on every of those patches?
Quoted 6 lines
Omit an extra message for a memory allocation failure in this function.
This issue was detected by using the Coccinelle software.
And why do you create a patch for every occasion in the same file? Do you want to increase your patch count?
Re: zswap: Delete an error message for a failed memory allocation in zswap_dstmem_prepare()
Quoted 1 line
Markus, can you please stop CCing me on every of those patches?
Yes, of course.
Quoted 1 line
Did I interpret any information from your presentation slides in an inappropriate way?
Quoted 1 line
And why do you create a patch for every occasion in the same file?
This can occasionally happen when I am more unsure about the change acceptance for a specific place.
Quoted 1 line
Do you want to increase your patch count?
This can also happen as a side effect if such a source code search pattern will point hundreds of places out for further software development considerations. How would you prefer to clarify the remaining update candidates there?
Regards,
Markus
Re: zswap: Delete an error message for a failed memory allocation in zswap_dstmem_prepare()
Markus,
Quoted 3 lines
Quoted 1 line
Markus, can you please stop CCing me on every of those patches?
Yes, of course.
Thanks!
Quoted 4 lines
Quoted 1 line
Did I interpret any information from your presentation slides in an inappropriate way?
Have you read my LWN article "Best practices for a big patch series"?
https://lwn.net/Articles/585782/
Quoted 4 lines
Quoted 1 line
And why do you create a patch for every occasion in the same file?
This can occasionally happen when I am more unsure about the change acceptance for a specific place.
Why were you unsure here?
Quoted 3 lines
This can also happen as a side effect if such a source code search pattern will point hundreds of places out for further software development considerations. How would you prefer to clarify the remaining update candidates there?
Maybe the article mentioned can provice further guidance?
Have a nice sunday,
Wolfram
Re: Using best practices for big software change possibilities
Quoted 3 lines
Have you read my LWN article "Best practices for a big patch series"?
Yes.
Quoted 5 lines
Quoted 3 lines
This can also happen as a side effect if such a source code search pattern will point hundreds of places out for further software development considerations. How would you prefer to clarify the remaining update candidates there?
Maybe the article mentioned can provice further guidance?
Partly, yes.
I am trying to achieve some software improvements also for special change patterns. This approach can trigger corresponding communication difficulties. How do you think about to resolve them by additional means besides mail exchange?
Regards,
Markus
Re: Using best practices for big software change possibilities
Quoted 2 lines
How do you think about to resolve them by additional means besides mail exchange?
That can work. E.g. meeting at conferences often solved mail communication problems.
For now, I still wonder why you were unsure about grouping the changes into one patch? Maybe there is something to be learned?
Re: Using best practices for big software change possibilities
Quoted 3 lines
Quoted 1 line
How do you think about to resolve them by additional means besides mail exchange?
That can work.
I am curious to find out which other communication means could really help here.
Quoted 1 line
E.g. meeting at conferences often solved mail communication problems.
I find my resources too limited at the moment to attend conferences on site.
How are the chances for further clarification by ordinary telephone calls?
Quoted 2 lines
For now, I still wonder why you were unsure about grouping the changes into one patch?
I am varying the patch granularity for affected software areas to some degree. But I came also places along where I got an impression for higher uncertainty.
Quoted 1 line
Maybe there is something to be learned?
This is also generally possible.
Would you like to extend the scope for the change pattern around questionable error messages from a single source file to whole subsystem trees in Linux?
Regards,
Markus
Re: [PATCH 3/3] zswap: Delete an error message for a failed memory allocation in zswap_dstmem_prepare()
In reply to SF Markus ElfringQuoted 9 lines · SF Markus Elfring
From: Markus Elfring <[email protected]>
Date: Sun, 21 May 2017 09:29:25 +0200Omit an extra message for a memory allocation failure in this function.
This issue was detected by using the Coccinelle software.
Quoted 21 lines
--- mm/zswap.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)mm/zswap.c +2
-4@@ -374,7 +374,6 @@ static int zswap_dstmem_prepare(unsigned int cpu) -if (!dst) { -pr_err ("can't allocate compressor buffer\n" ); +if (!dst)return -ENOMEM ; - } +per_cpu (zswap_dstmem, cpu) = dst;return 0 ; } --2.13.0