netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Markus Pargmann <mpa@pengutronix.de>
To: Joe Perches <joe@perches.com>
Cc: Marc Kleine-Budde <mkl@pengutronix.de>,
	Wolfgang Grandegger <wg@grandegger.com>,
	linux-can@vger.kernel.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, kernel@pengutronix.de
Subject: Re: [PATCH v2] can: c_can: Speed up rx_poll function
Date: Tue, 29 Oct 2013 09:58:53 +0100	[thread overview]
Message-ID: <20131029085853.GC20839@pengutronix.de> (raw)
In-Reply-To: <1383035688.2713.2.camel@joe-AO722>

On Tue, Oct 29, 2013 at 01:34:48AM -0700, Joe Perches wrote:
> On Tue, 2013-10-29 at 09:27 +0100, Markus Pargmann wrote:
> > This patch speeds up the rx_poll function by reducing the number of
> > register reads.
> []
> > 125kbit:
> >   Function                               Hit    Time            Avg             s^2
> >   --------                               ---    ----            ---             ---
> >   c_can_do_rx_poll                     63960    10168178 us     158.977 us      1493056 us
> > With patch:
> >   c_can_do_rx_poll                     63939    4268457 us     66.758 us       818790.9 us
> > 
> > 1Mbit:
> >   Function                               Hit    Time            Avg             s^2
> >   --------                               ---    ----            ---             ---
> >   c_can_do_rx_poll                     69489    30049498 us     432.435 us      9271851 us
> > With patch:
> >   c_can_do_rx_poll                    103034    24220362 us     235.071 us      6016656 us
> 
> Also nicer if you updated the timings table
> 
> 

Yes I just measured the timings again:

./perf_can_test.sh 125000 30
  Function                               Hit    Time            Avg             s^2
  --------                               ---    ----            ---             ---
  c_can_poll                          127882    6178806 us     48.316 us       4393411 us 
  c_can_do_rx_poll                     63941    3764057 us     58.867 us       776162.2 us 
  c_can_enable_all_interrupts         255764    2213697 us     8.655 us        1093934 us 
  c_can_plat_write_reg_aligned_t      807252    1607115 us     1.990 us        10053684 us 
  c_can_isr                           127882    1220001 us     9.540 us        789.495 us  
  c_can_object_put                    119887    1039222 us     8.668 us        1608.668 us 
  c_can_plat_read_reg_aligned_to     1015072    1033283 us     1.017 us        7021.465 us 
  c_can_read_msg_object                63943    1026159 us     16.048 us       718.464 us  
  c_can_activate_all_lower_rx_ms        7992    755782.4 us     94.567 us       55.270 us   
  c_can_mark_rx_msg_obj                55951    709072.1 us     12.673 us       39.974 us   
  c_can_object_get                     63943    555669.2 us     8.690 us        96.211 us   
  c_can_msg_obj_is_busy               183830    527826.1 us     2.871 us        7289.221 us 
  alloc_can_skb                        63943    170966.6 us     2.673 us        165.765 us  
  c_can_has_and_handle_berr            63941    47063.18 us     0.736 us        2.757 us    

./perf_can_test.sh 1000000 30
  Function                               Hit    Time            Avg             s^2
  --------                               ---    ----            ---             ---
  c_can_poll                          270678    30290751 us     111.906 us      5809627 us 
  c_can_do_rx_poll                    207109    24322185 us     117.436 us      171469047 us 
  c_can_object_put                    841431    7278794 us     8.650 us        305841.0 us 
  c_can_plat_write_reg_aligned_t     4037180    6244636 us     1.546 us        4581066 us 
  c_can_read_msg_object               453988    6033464 us     13.289 us       128809.6 us 
  c_can_enable_all_interrupts         541342    5849826 us     10.806 us       22458900 us 
  c_can_activate_all_lower_rx_ms       55349    5237761 us     94.631 us       19004.79 us 
  c_can_mark_rx_msg_obj               387429    4865632 us     12.558 us       380606.4 us 
  c_can_plat_read_reg_aligned_to     4597629    4633247 us     1.007 us        315286.2 us 
  c_can_object_get                    453988    3919692 us     8.633 us        59847.76 us 
  c_can_msg_obj_is_busy              1295419    3706862 us     2.861 us        316655.7 us 
  c_can_isr                           270671    2496734 us     9.224 us        530.967 us  
  alloc_can_skb                       453988    856917.4 us     1.887 us        18157.68 us 
  c_can_activate_rx_msg_obj            11210    141177.4 us     12.593 us       123.068 us  
  c_can_has_and_handle_berr            63569    44995.85 us     0.707 us        12.780 us

It is interesting that the number of hits for c_can_do_rx_poll is twice as much
as it was with find_next_bit. Unfortunately this reduces the overall benefit of
this patch. Any ideas how to increase the number of waiting message objects we
handle in one poll call?


Regards,

Markus

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

  parent reply	other threads:[~2013-10-29  8:58 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-29  8:27 [PATCH v2] can: c_can: Speed up rx_poll function Markus Pargmann
2013-10-29  8:31 ` Joe Perches
     [not found] ` <1383035688.2713.2.camel@joe-AO722>
2013-10-29  8:58   ` Markus Pargmann [this message]
2013-10-29 16:24     ` Joe Perches
2013-10-30  7:54       ` Markus Pargmann

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=20131029085853.GC20839@pengutronix.de \
    --to=mpa@pengutronix.de \
    --cc=joe@perches.com \
    --cc=kernel@pengutronix.de \
    --cc=linux-can@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mkl@pengutronix.de \
    --cc=netdev@vger.kernel.org \
    --cc=wg@grandegger.com \
    /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).