From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
To: Bryton Lee <brytonlee01@gmail.com>,
stephen@networkplumber.org, netdev@vger.kernel.org,
davem@davemloft.net
Cc: eric.dumazet@gmail.com
Subject: Re: [PATCH] prevent the read ahead of /proc/slabinfo in ss - take 3
Date: Tue, 10 Feb 2015 15:51:29 +0300 [thread overview]
Message-ID: <54D9FED1.9030903@cogentembedded.com> (raw)
In-Reply-To: <1423547533-6727-1-git-send-email-brytonlee01@gmail.com>
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@gmail.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
next prev parent reply other threads:[~2015-02-10 12:51 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-10 5:52 [PATCH] prevent the read ahead of /proc/slabinfo in ss - take 3 Bryton Lee
2015-02-10 12:51 ` Sergei Shtylyov [this message]
2015-02-12 1:21 ` Bryton Lee
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=54D9FED1.9030903@cogentembedded.com \
--to=sergei.shtylyov@cogentembedded.com \
--cc=brytonlee01@gmail.com \
--cc=davem@davemloft.net \
--cc=eric.dumazet@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=stephen@networkplumber.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).