diff mbox

[net-next] net: rfs: Don't reset RFS entries when nothing changed

Message ID 1495500311-81095-1-git-send-email-gfree.wind@vip.163.com
State Rejected, archived
Delegated to: David Miller
Headers show

Commit Message

Gao Feng May 23, 2017, 12:45 a.m. UTC
From: Gao Feng <gfree.wind@vip.163.com>

When the new RFS table size specified by sysctl equals the old one,
there is nothing changed actually. So it is unnecessary to reset the
RFS table entris.

Signed-off-by: Gao Feng <gfree.wind@vip.163.com>
---
 net/core/sysctl_net_core.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

David Miller May 23, 2017, 3:02 a.m. UTC | #1
From: gfree.wind@vip.163.com
Date: Tue, 23 May 2017 08:45:11 +0800

> From: Gao Feng <gfree.wind@vip.163.com>
> 
> When the new RFS table size specified by sysctl equals the old one,
> there is nothing changed actually. So it is unnecessary to reset the
> RFS table entris.
> 
> Signed-off-by: Gao Feng <gfree.wind@vip.163.com>

It seems like an intentional feature to be able to reset the
table by simply writing the same value to the sysfs knob.

I'm not applying this, sorry.
Gao Feng May 23, 2017, 3:10 a.m. UTC | #2
At 2017-05-23 11:02:20, "David Miller" <davem@davemloft.net> wrote:
>From: gfree.wind@vip.163.com
>Date: Tue, 23 May 2017 08:45:11 +0800
>
>> From: Gao Feng <gfree.wind@vip.163.com>
>> 
>> When the new RFS table size specified by sysctl equals the old one,
>> there is nothing changed actually. So it is unnecessary to reset the
>> RFS table entris.
>> 
>> Signed-off-by: Gao Feng <gfree.wind@vip.163.com>
>
>It seems like an intentional feature to be able to reset the
>table by simply writing the same value to the sysfs knob.
>
>I'm not applying this, sorry.

It is ok.
I just thought maybe it was used to reset, but I didn't find any comment and tips by google.

Regards
Feng
diff mbox

Patch

diff --git a/net/core/sysctl_net_core.c b/net/core/sysctl_net_core.c
index ea23254..80b6a7e 100644
--- a/net/core/sysctl_net_core.c
+++ b/net/core/sysctl_net_core.c
@@ -69,11 +69,12 @@  static int rps_sock_flow_sysctl(struct ctl_table *table, int write,
 				}
 				rps_cpu_mask = roundup_pow_of_two(nr_cpu_ids) - 1;
 				sock_table->mask = size - 1;
+
+				for (i = 0; i < size; i++)
+					sock_table->ents[i] = RPS_NO_CPU;
 			} else
 				sock_table = orig_sock_table;
 
-			for (i = 0; i < size; i++)
-				sock_table->ents[i] = RPS_NO_CPU;
 		} else
 			sock_table = NULL;