[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <54D9FED1.9030903@cogentembedded.com>
Date: Tue, 10 Feb 2015 15:51:29 +0300
From: Sergei Shtylyov <sergei.shtylyov@...entembedded.com>
To: Bryton Lee <brytonlee01@...il.com>, stephen@...workplumber.org,
netdev@...r.kernel.org, davem@...emloft.net
CC: eric.dumazet@...il.com
Subject: Re: [PATCH] prevent the read ahead of /proc/slabinfo in ss - take
3
On 2/10/2015 8:52 AM, Bryton Lee wrote:
> prevent the read ahead of /proc/slabinfo in ss.
> Signed-off-by: Bryton Lee <brytonlee01@...il.com>
> ---
> misc/ss.c | 13 ++++++++++---
> 1 file changed, 10 insertions(+), 3 deletions(-)
> diff --git a/misc/ss.c b/misc/ss.c
> index 7fc0a99..74721b5 100644
> --- a/misc/ss.c
> +++ b/misc/ss.c
[...]
> @@ -655,6 +656,8 @@ static int get_slabstat(struct slabstat *s)
> break;
> }
>
> + slabstat_valid = 1;
This is indented incorrectly. Use one TAB please.
> +
> fclose(fp);
> return 0;
> }
> @@ -2230,6 +2233,9 @@ static int tcp_show(struct filter *f, int socktype)
> * it is able to give us some memory for snapshot.
> */
> if (1) {
> + if (!slabstat_valid)
> + get_slabstat(&slabstat);
> +
> int guess = slabstat.socks+slabstat.tcp_syns;
> if (f->states&(1<<SS_TIME_WAIT))
> guess += slabstat.tcp_tws;
> @@ -3196,6 +3202,9 @@ static int print_summary(void)
> if (get_snmp_int("Tcp:", "CurrEstab", &sn.tcp_estab) < 0)
> perror("ss: get_snmpstat");
>
> + if (!slabstat_valid)
> + get_slabstat(&slabstat);
> +
Can't you perform this check inside get_slabstat()?
[...]
WBR, Sergei
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists