linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm: compaction.c: Propagate return value upstream
@ 2018-12-26 19:42 Aditya Pakki
  2018-12-27  3:50 ` Matthew Wilcox
  0 siblings, 1 reply; 6+ messages in thread
From: Aditya Pakki @ 2018-12-26 19:42 UTC (permalink / raw)
  To: pakki001
  Cc: kjlu, Andrew Morton, Michal Hocko, Vlastimil Babka, Joonsoo Kim,
	David Rientjes, Yang Shi, Johannes Weiner, Joe Perches, linux-mm,
	linux-kernel

In sysctl_extfrag_handler(), proc_dointvec_minmax() can return an
error. The fix propagates the error upstream in case of failure.

Signed-off-by: Aditya Pakki <pakki001@umn.edu>
---
 mm/compaction.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/mm/compaction.c b/mm/compaction.c
index 7c607479de4a..d108974d0867 100644
--- a/mm/compaction.c
+++ b/mm/compaction.c
@@ -1879,9 +1879,7 @@ int sysctl_compaction_handler(struct ctl_table *table, int write,
 int sysctl_extfrag_handler(struct ctl_table *table, int write,
 			void __user *buffer, size_t *length, loff_t *ppos)
 {
-	proc_dointvec_minmax(table, write, buffer, length, ppos);
-
-	return 0;
+	return proc_dointvec_minmax(table, write, buffer, length, ppos);
 }
 
 #if defined(CONFIG_SYSFS) && defined(CONFIG_NUMA)
-- 
2.17.1


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

* Re: [PATCH] mm: compaction.c: Propagate return value upstream
  2018-12-26 19:42 [PATCH] mm: compaction.c: Propagate return value upstream Aditya Pakki
@ 2018-12-27  3:50 ` Matthew Wilcox
  2018-12-27 16:44   ` Randy Dunlap
  2019-01-02 12:24   ` Mel Gorman
  0 siblings, 2 replies; 6+ messages in thread
From: Matthew Wilcox @ 2018-12-27  3:50 UTC (permalink / raw)
  To: Aditya Pakki
  Cc: kjlu, Andrew Morton, Michal Hocko, Vlastimil Babka, Joonsoo Kim,
	David Rientjes, Yang Shi, Johannes Weiner, Joe Perches, linux-mm,
	linux-kernel, Mel Gorman, Randy Dunlap

On Wed, Dec 26, 2018 at 01:42:56PM -0600, Aditya Pakki wrote:
> In sysctl_extfrag_handler(), proc_dointvec_minmax() can return an
> error. The fix propagates the error upstream in case of failure.

Why not just ...

Mel, Randy?  You seem to have been the prime instigators on this.

diff --git a/include/linux/compaction.h b/include/linux/compaction.h
index 68250a57aace..70d0256edd31 100644
--- a/include/linux/compaction.h
+++ b/include/linux/compaction.h
@@ -88,8 +88,6 @@ extern int sysctl_compact_memory;
 extern int sysctl_compaction_handler(struct ctl_table *table, int write,
 			void __user *buffer, size_t *length, loff_t *ppos);
 extern int sysctl_extfrag_threshold;
-extern int sysctl_extfrag_handler(struct ctl_table *table, int write,
-			void __user *buffer, size_t *length, loff_t *ppos);
 extern int sysctl_compact_unevictable_allowed;
 
 extern int fragmentation_index(struct zone *zone, unsigned int order);
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 5fc724e4e454..e9c69247fc29 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -1439,7 +1439,7 @@ static struct ctl_table vm_table[] = {
 		.data		= &sysctl_extfrag_threshold,
 		.maxlen		= sizeof(int),
 		.mode		= 0644,
-		.proc_handler	= sysctl_extfrag_handler,
+		.proc_handler	= proc_dointvec_minmax,
 		.extra1		= &min_extfrag_threshold,
 		.extra2		= &max_extfrag_threshold,
 	},
diff --git a/mm/compaction.c b/mm/compaction.c
index 7c607479de4a..80b941d9b6e7 100644
--- a/mm/compaction.c
+++ b/mm/compaction.c
@@ -1876,14 +1876,6 @@ int sysctl_compaction_handler(struct ctl_table *table, int write,
 	return 0;
 }
 
-int sysctl_extfrag_handler(struct ctl_table *table, int write,
-			void __user *buffer, size_t *length, loff_t *ppos)
-{
-	proc_dointvec_minmax(table, write, buffer, length, ppos);
-
-	return 0;
-}
-
 #if defined(CONFIG_SYSFS) && defined(CONFIG_NUMA)
 static ssize_t sysfs_compact_node(struct device *dev,
 			struct device_attribute *attr,

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

* Re: [PATCH] mm: compaction.c: Propagate return value upstream
  2018-12-27  3:50 ` Matthew Wilcox
@ 2018-12-27 16:44   ` Randy Dunlap
  2019-01-02 12:24   ` Mel Gorman
  1 sibling, 0 replies; 6+ messages in thread
From: Randy Dunlap @ 2018-12-27 16:44 UTC (permalink / raw)
  To: Matthew Wilcox, Aditya Pakki
  Cc: kjlu, Andrew Morton, Michal Hocko, Vlastimil Babka, Joonsoo Kim,
	David Rientjes, Yang Shi, Johannes Weiner, Joe Perches, linux-mm,
	linux-kernel, Mel Gorman

On 12/26/18 7:50 PM, Matthew Wilcox wrote:
> On Wed, Dec 26, 2018 at 01:42:56PM -0600, Aditya Pakki wrote:
>> In sysctl_extfrag_handler(), proc_dointvec_minmax() can return an
>> error. The fix propagates the error upstream in case of failure.
> 
> Why not just ...

Yes, this change (below) makes sense to me.

> Mel, Randy?  You seem to have been the prime instigators on this.

I expect that all I did was move the location of the source code lines of
the sysctl, but that is just a guess, based on this commit message:
  [randy.dunlap@oracle.com: Fix build errors when proc fs is not configured]

> diff --git a/include/linux/compaction.h b/include/linux/compaction.h
> index 68250a57aace..70d0256edd31 100644
> --- a/include/linux/compaction.h
> +++ b/include/linux/compaction.h
> @@ -88,8 +88,6 @@ extern int sysctl_compact_memory;
>  extern int sysctl_compaction_handler(struct ctl_table *table, int write,
>  			void __user *buffer, size_t *length, loff_t *ppos);
>  extern int sysctl_extfrag_threshold;
> -extern int sysctl_extfrag_handler(struct ctl_table *table, int write,
> -			void __user *buffer, size_t *length, loff_t *ppos);
>  extern int sysctl_compact_unevictable_allowed;
>  
>  extern int fragmentation_index(struct zone *zone, unsigned int order);
> diff --git a/kernel/sysctl.c b/kernel/sysctl.c
> index 5fc724e4e454..e9c69247fc29 100644
> --- a/kernel/sysctl.c
> +++ b/kernel/sysctl.c
> @@ -1439,7 +1439,7 @@ static struct ctl_table vm_table[] = {
>  		.data		= &sysctl_extfrag_threshold,
>  		.maxlen		= sizeof(int),
>  		.mode		= 0644,
> -		.proc_handler	= sysctl_extfrag_handler,
> +		.proc_handler	= proc_dointvec_minmax,
>  		.extra1		= &min_extfrag_threshold,
>  		.extra2		= &max_extfrag_threshold,
>  	},
> diff --git a/mm/compaction.c b/mm/compaction.c
> index 7c607479de4a..80b941d9b6e7 100644
> --- a/mm/compaction.c
> +++ b/mm/compaction.c
> @@ -1876,14 +1876,6 @@ int sysctl_compaction_handler(struct ctl_table *table, int write,
>  	return 0;
>  }
>  
> -int sysctl_extfrag_handler(struct ctl_table *table, int write,
> -			void __user *buffer, size_t *length, loff_t *ppos)
> -{
> -	proc_dointvec_minmax(table, write, buffer, length, ppos);
> -
> -	return 0;
> -}
> -
>  #if defined(CONFIG_SYSFS) && defined(CONFIG_NUMA)
>  static ssize_t sysfs_compact_node(struct device *dev,
>  			struct device_attribute *attr,
> 


-- 
~Randy

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

* Re: [PATCH] mm: compaction.c: Propagate return value upstream
  2018-12-27  3:50 ` Matthew Wilcox
  2018-12-27 16:44   ` Randy Dunlap
@ 2019-01-02 12:24   ` Mel Gorman
  1 sibling, 0 replies; 6+ messages in thread
From: Mel Gorman @ 2019-01-02 12:24 UTC (permalink / raw)
  To: Matthew Wilcox
  Cc: Aditya Pakki, kjlu, Andrew Morton, Michal Hocko, Vlastimil Babka,
	Joonsoo Kim, David Rientjes, Yang Shi, Johannes Weiner,
	Joe Perches, linux-mm, linux-kernel, Randy Dunlap

On Wed, Dec 26, 2018 at 07:50:29PM -0800, Matthew Wilcox wrote:
> On Wed, Dec 26, 2018 at 01:42:56PM -0600, Aditya Pakki wrote:
> > In sysctl_extfrag_handler(), proc_dointvec_minmax() can return an
> > error. The fix propagates the error upstream in case of failure.
> 
> Why not just ...
> 
> Mel, Randy?  You seem to have been the prime instigators on this.
> 

Patch seems fine.

Acked-by: Mel Gorman <mgorman@techsingularity.net>

-- 
Mel Gorman
SUSE Labs

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

* Re: [PATCH] mm: compaction.c: Propagate return value upstream
  2018-12-26 19:07 Aditya Pakki
@ 2018-12-26 19:11 ` Matthew Wilcox
  0 siblings, 0 replies; 6+ messages in thread
From: Matthew Wilcox @ 2018-12-26 19:11 UTC (permalink / raw)
  To: Aditya Pakki
  Cc: kjlu, Andrew Morton, Vlastimil Babka, Michal Hocko,
	David Rientjes, Joonsoo Kim, Yang Shi, Johannes Weiner,
	Joe Perches, linux-mm, linux-kernel

On Wed, Dec 26, 2018 at 01:07:49PM -0600, Aditya Pakki wrote:
>  {
> +	return
>  	proc_dointvec_minmax(table, write, buffer, length, ppos);
> -
> -	return 0;

Don't do this.  If you're going to return something, it should be on the same
line as the return statement.

ie:

+	return proc_dointvec_minmax(table, write, buffer, length, ppos);


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

* [PATCH] mm: compaction.c: Propagate return value upstream
@ 2018-12-26 19:07 Aditya Pakki
  2018-12-26 19:11 ` Matthew Wilcox
  0 siblings, 1 reply; 6+ messages in thread
From: Aditya Pakki @ 2018-12-26 19:07 UTC (permalink / raw)
  To: pakki001
  Cc: kjlu, Andrew Morton, Vlastimil Babka, Michal Hocko,
	David Rientjes, Joonsoo Kim, Yang Shi, Johannes Weiner,
	Joe Perches, linux-mm, linux-kernel

In sysctl_extfrag_handler(), proc_dointvec_minmax() can return an
error. The fix propagates the error upstream in case of failure.

Signed-off-by: Aditya Pakki <pakki001@umn.edu>
---
 mm/compaction.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/mm/compaction.c b/mm/compaction.c
index 7c607479de4a..5703b4051796 100644
--- a/mm/compaction.c
+++ b/mm/compaction.c
@@ -1879,9 +1879,8 @@ int sysctl_compaction_handler(struct ctl_table *table, int write,
 int sysctl_extfrag_handler(struct ctl_table *table, int write,
 			void __user *buffer, size_t *length, loff_t *ppos)
 {
+	return
 	proc_dointvec_minmax(table, write, buffer, length, ppos);
-
-	return 0;
 }
 
 #if defined(CONFIG_SYSFS) && defined(CONFIG_NUMA)
-- 
2.17.1


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

end of thread, other threads:[~2019-01-02 12:24 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-26 19:42 [PATCH] mm: compaction.c: Propagate return value upstream Aditya Pakki
2018-12-27  3:50 ` Matthew Wilcox
2018-12-27 16:44   ` Randy Dunlap
2019-01-02 12:24   ` Mel Gorman
  -- strict thread matches above, loose matches on Subject: below --
2018-12-26 19:07 Aditya Pakki
2018-12-26 19:11 ` Matthew Wilcox

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).