From: Eric Dumazet <eric.dumazet@gmail.com>
To: brenohl@br.ibm.com
Cc: davem@davemloft.net, netdev@vger.kernel.org,
Breno Leitao <leitao@linux.vnet.ibm.com>
Subject: Re: [PATCH net-next] ehea: Remove sleep at .ndo_get_stats
Date: Thu, 22 Sep 2011 17:14:57 +0200 [thread overview]
Message-ID: <1316704497.29549.10.camel@edumazet-HP-Compaq-6005-Pro-SFF-PC> (raw)
In-Reply-To: <1316700657-14980-1-git-send-email-brenohl@br.ibm.com>
Le jeudi 22 septembre 2011 à 11:10 -0300, brenohl@br.ibm.com a écrit :
> Currently ehea ndo_get_stats can sleep in two places, in a hcall
> and in a GFP_KERNEL alloc, which is not correct.
> This patch creates a workqueue that grabs the information from time
> to time from the hardware, and place it into the device structure,
> so that, .ndo_get_stats quickly returns the device structure statistics
> block.
>
> Signed-off-by: Breno Leitao <leitao@linux.vnet.ibm.com>
> ---
Hmm... trigerring a work queue everytime NAPI is run ? That seems very
expensive to me, if for example no one wants device stats at all.
I read ehea correctly, this blocking suff is only used to compute
stats->multicast and stats->rx_errors.
They probably could be updated once per second, nobody will complain.
(So use a workqueue, and trigger the job once per second, not once per
incoming packet)
Also, you dont provide a safe ndo_get_stats() implementation.
Think that several process might read your device stats in //
So the memset(stats, 0, sizeof(*stats)) is wrong :
You can clear stats that are currently read by another thread.
This makes SNMP readers read intermediate null values, and they dont
like this.
Fix is real easy : remove the memset(stats, 0, sizeof(*stats)) :
You only write on some fields, other fields are already 0
next prev parent reply other threads:[~2011-09-22 15:14 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-22 14:10 [PATCH net-next] ehea: Remove sleep at .ndo_get_stats brenohl
2011-09-22 15:14 ` Eric Dumazet [this message]
2011-09-26 17:15 ` [PATCH] " brenohl
2011-09-26 18:02 ` Eric Dumazet
2011-09-26 18:56 ` Breno Leitao
2011-09-26 19:21 ` brenohl
2011-09-26 19:42 ` Eric Dumazet
2011-09-26 20:11 ` brenohl
2011-09-26 20:28 ` Eric Dumazet
2011-09-27 4:47 ` David Miller
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=1316704497.29549.10.camel@edumazet-HP-Compaq-6005-Pro-SFF-PC \
--to=eric.dumazet@gmail.com \
--cc=brenohl@br.ibm.com \
--cc=davem@davemloft.net \
--cc=leitao@linux.vnet.ibm.com \
--cc=netdev@vger.kernel.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