[CRIU] [PATCH 1/2] tcp_read_sysctl_limits(): simplify vect
Kir Kolyshkin
kir at openvz.org
Wed Oct 14 15:09:56 PDT 2015
I spent some time trying to figure out why vect array
is declared as [2][3], also why vect[0] is not used.
The answer is commit 4bca68b that removed code using it.
Let's save a few bytes, and make the code more readable.
Signed-off-by: Kir Kolyshkin <kir at openvz.org>
---
kerndat.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/kerndat.c b/kerndat.c
index d6e54f8..1bce836 100644
--- a/kerndat.c
+++ b/kerndat.c
@@ -210,11 +210,11 @@ int kerndat_get_dirty_track(void)
static int tcp_read_sysctl_limits(void)
{
- u32 vect[2][3] = { };
+ u32 vect[3] = { };
int ret;
struct sysctl_req req[] = {
- { "net/ipv4/tcp_rmem", &vect[1], CTL_U32A(ARRAY_SIZE(vect[1])) },
+ { "net/ipv4/tcp_rmem", &vect, CTL_U32A(ARRAY_SIZE(vect)) },
};
/*
@@ -227,7 +227,7 @@ static int tcp_read_sysctl_limits(void)
goto out;
}
- kdat.tcp_max_rshare = min(kdat.tcp_max_rshare, (int)vect[1][2]);
+ kdat.tcp_max_rshare = min(kdat.tcp_max_rshare, (int)vect[2]);
if (kdat.tcp_max_rshare < 128)
pr_warn("The memory limits for TCP queues are suspiciously small\n");
--
2.4.3
More information about the CRIU
mailing list