From: Jean Delvare <khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org>
To: Olivier Sobrie <olivier-Ui3EtX6WB9GzQB+pC5nmwQ@public.gmane.org>
Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Ben Dooks <ben-linux-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org>,
Wolfram Sang <w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
Subject: Re: [PATCH] i2c-isch: Decrease delay in the loop checking the BUSY state of the bus
Date: Tue, 24 Jan 2012 17:04:27 +0100 [thread overview]
Message-ID: <20120124170427.32fb661a@endymion.delvare> (raw)
In-Reply-To: <20120124140750.GA23967@hposo>
On Tue, 24 Jan 2012 15:07:50 +0100, Olivier Sobrie wrote:
> I performed the same test you did on my system and I observed this:
>
> * msleep(1)
> real 0m 51.20s
> user 0m 0.29s
> sys 0m 0.00s
I assume your kernel has HZ=100, that means 20 ms per transaction i.e.
2 jiffies, as expected from the msleep() implementation.
>
> * usleep_range(100, 200)
> real 0m 1.46s
> user 0m 0.10s
> sys 0m 0.10s
>
> * usleep_range(250, 500)
> real 0m 2.01s
> user 0m 0.05s
> sys 0m 0.25s
It's really curious that this can take more CPU time than
usleep_range(100, 200). I can't explain it.
>
> * usleep_range(50, 150)
> real 0m 1.43s
> user 0m 0.07s
> sys 0m 0.23s
>
> I think usleep_range(100, 200) is the best compromise.
I agree.
> (...)
> I agree udelay() is not a good solution!
> I did the test without hrtimers using usleep_range(100, 200) and got:
> real 0m 25.60s
> user 0m 0.30s
> sys 0m 0.00s
> So that's not slower than msleep(1) in the case of no hrtimers.
In fact that's exactly twice as fast as msleep(2), i.e. 1 jiffy per
transaction instead of 2. That's pretty good that there is a benefit
even without hrtimers support. Thanks for testing and reporting,
that's one less thing on my to-do list :)
I'll send a patch similar to yours for the i2c-i801 driver in a minute.
Thanks for showing us the way!
--
Jean Delvare
prev parent reply other threads:[~2012-01-24 16:04 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-20 11:46 [PATCH] i2c-isch: Decrease delay in the loop checking the BUSY state of the bus Olivier Sobrie
[not found] ` <1327060014-7604-1-git-send-email-olivier-Ui3EtX6WB9GzQB+pC5nmwQ@public.gmane.org>
2012-01-23 15:26 ` Jean Delvare
[not found] ` <20120123162620.031ade7f-R0o5gVi9kd7kN2dkZ6Wm7A@public.gmane.org>
2012-01-24 8:46 ` Olivier Sobrie
2012-01-24 9:58 ` Jean Delvare
[not found] ` <20120124105838.08c2a652-R0o5gVi9kd7kN2dkZ6Wm7A@public.gmane.org>
2012-01-24 14:07 ` Olivier Sobrie
2012-01-24 16:04 ` Jean Delvare [this message]
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=20120124170427.32fb661a@endymion.delvare \
--to=khali-puyad+kwke1g9huczpvpmw@public.gmane.org \
--cc=ben-linux-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org \
--cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=olivier-Ui3EtX6WB9GzQB+pC5nmwQ@public.gmane.org \
--cc=w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.