linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm:Make the function set_recommended_min_free_kbytes have a return type of void
@ 2015-07-01 17:45 Nicholas Krause
  2015-07-02  7:23 ` Michal Hocko
  0 siblings, 1 reply; 3+ messages in thread
From: Nicholas Krause @ 2015-07-01 17:45 UTC (permalink / raw)
  To: akpm
  Cc: kirill.shutemov, mgorman, rientjes, vbabka, aneesh.kumar,
	ebru.akagunduz, hannes, mhocko, linux-mm, linux-kernel

This makes the function set_recommended_min_free_kbytes have a
return type of void now due to this particular function never
needing to signal it's call if it fails due to this function
always completing successfully without issue.

Signed-off-by: Nicholas Krause <xerofoify@gmail.com>
---
 mm/huge_memory.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/mm/huge_memory.c b/mm/huge_memory.c
index c107094..914a72a 100644
--- a/mm/huge_memory.c
+++ b/mm/huge_memory.c
@@ -104,7 +104,7 @@ static struct khugepaged_scan khugepaged_scan = {
 };
 
 
-static int set_recommended_min_free_kbytes(void)
+static void set_recommended_min_free_kbytes(void)
 {
 	struct zone *zone;
 	int nr_zones = 0;
@@ -139,7 +139,6 @@ static int set_recommended_min_free_kbytes(void)
 		min_free_kbytes = recommended_min;
 	}
 	setup_per_zone_wmarks();
-	return 0;
 }
 
 static int start_stop_khugepaged(void)
-- 
2.1.4

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

* Re: [PATCH] mm:Make the function set_recommended_min_free_kbytes have a return type of void
  2015-07-01 17:45 [PATCH] mm:Make the function set_recommended_min_free_kbytes have a return type of void Nicholas Krause
@ 2015-07-02  7:23 ` Michal Hocko
  2015-07-02 13:25   ` nick
  0 siblings, 1 reply; 3+ messages in thread
From: Michal Hocko @ 2015-07-02  7:23 UTC (permalink / raw)
  To: Nicholas Krause
  Cc: akpm, kirill.shutemov, mgorman, rientjes, vbabka, aneesh.kumar,
	ebru.akagunduz, hannes, linux-mm, linux-kernel

On Wed 01-07-15 13:45:15, Nicholas Krause wrote:
> This makes the function set_recommended_min_free_kbytes have a
> return type of void now due to this particular function never
> needing to signal it's call if it fails due to this function
> always completing successfully without issue.

The changelog is hard to read for me.
"
The function cannot possibly fail so it doesn't make much sense to have
a return value. Make it void.
"
Would sound much easier to parse for me.

I doubt this would help the compiler to generate a better code but in
general it is better to have void return type when there is no failure
possible - which is the case here.

> Signed-off-by: Nicholas Krause <xerofoify@gmail.com>

Acked-by: Michal Hocko <mhocko@suse.cz>

> ---
>  mm/huge_memory.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/mm/huge_memory.c b/mm/huge_memory.c
> index c107094..914a72a 100644
> --- a/mm/huge_memory.c
> +++ b/mm/huge_memory.c
> @@ -104,7 +104,7 @@ static struct khugepaged_scan khugepaged_scan = {
>  };
>  
>  
> -static int set_recommended_min_free_kbytes(void)
> +static void set_recommended_min_free_kbytes(void)
>  {
>  	struct zone *zone;
>  	int nr_zones = 0;
> @@ -139,7 +139,6 @@ static int set_recommended_min_free_kbytes(void)
>  		min_free_kbytes = recommended_min;
>  	}
>  	setup_per_zone_wmarks();
> -	return 0;
>  }
>  
>  static int start_stop_khugepaged(void)
> -- 
> 2.1.4
> 

-- 
Michal Hocko
SUSE Labs

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

* Re: [PATCH] mm:Make the function set_recommended_min_free_kbytes have a return type of void
  2015-07-02  7:23 ` Michal Hocko
@ 2015-07-02 13:25   ` nick
  0 siblings, 0 replies; 3+ messages in thread
From: nick @ 2015-07-02 13:25 UTC (permalink / raw)
  To: Michal Hocko
  Cc: akpm, kirill.shutemov, mgorman, rientjes, vbabka, aneesh.kumar,
	ebru.akagunduz, hannes, linux-mm, linux-kernel



On 2015-07-02 03:23 AM, Michal Hocko wrote:
> On Wed 01-07-15 13:45:15, Nicholas Krause wrote:
>> This makes the function set_recommended_min_free_kbytes have a
>> return type of void now due to this particular function never
>> needing to signal it's call if it fails due to this function
>> always completing successfully without issue.
> 
> The changelog is hard to read for me.
> "
> The function cannot possibly fail so it doesn't make much sense to have
> a return value. Make it void.
> "
> Would sound much easier to parse for me.
> 
> I doubt this would help the compiler to generate a better code but in
> general it is better to have void return type when there is no failure
> possible - which is the case here.
> 
>> Signed-off-by: Nicholas Krause <xerofoify@gmail.com>
> 
> Acked-by: Michal Hocko <mhocko@suse.cz>
> 
>> ---
>>  mm/huge_memory.c | 3 +--
>>  1 file changed, 1 insertion(+), 2 deletions(-)
>>
>> diff --git a/mm/huge_memory.c b/mm/huge_memory.c
>> index c107094..914a72a 100644
>> --- a/mm/huge_memory.c
>> +++ b/mm/huge_memory.c
>> @@ -104,7 +104,7 @@ static struct khugepaged_scan khugepaged_scan = {
>>  };
>>  
>>  
>> -static int set_recommended_min_free_kbytes(void)
>> +static void set_recommended_min_free_kbytes(void)
>>  {
>>  	struct zone *zone;
>>  	int nr_zones = 0;
>> @@ -139,7 +139,6 @@ static int set_recommended_min_free_kbytes(void)
>>  		min_free_kbytes = recommended_min;
>>  	}
>>  	setup_per_zone_wmarks();
>> -	return 0;
>>  }
>>  
>>  static int start_stop_khugepaged(void)
>> -- 
>> 2.1.4
>>
> 
That was exactly my point with these patches readability not compiler improvements.
Otherwise I would have stated that in my commit messages and would argue readability
improvements are important too for the kernel.
Nick 

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

end of thread, other threads:[~2015-07-02 13:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-01 17:45 [PATCH] mm:Make the function set_recommended_min_free_kbytes have a return type of void Nicholas Krause
2015-07-02  7:23 ` Michal Hocko
2015-07-02 13:25   ` nick

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox