All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sami Kerola <kerolasa@iki.fi>
To: Kay Sievers <kay@vrfy.org>
Cc: util-linux <util-linux@vger.kernel.org>
Subject: Re: [PATCH 03/34] include: copy unlocked-io.h from gnulib
Date: Sat, 13 Jul 2013 23:10:59 +0100	[thread overview]
Message-ID: <CAG27Bk2Oh+D9=H06a-L_4AccUqOsFPRpd9nfAEcXZkavzZM36Q@mail.gmail.com> (raw)
In-Reply-To: <CAPXgP103fWSyeM9Ph12yUhTZiuvbjHniG6GRwNVS2LSJVn-BUQ@mail.gmail.com>

On 9 July 2013 10:16, Kay Sievers <kay@vrfy.org> wrote:
> On Tue, Jul 9, 2013 at 8:37 AM, Sami Kerola <kerolasa@iki.fi> wrote:
>> On 8 July 2013 21:21, Kay Sievers <kay@vrfy.org> wrote:
>>> On Sun, Jul 7, 2013 at 9:54 PM, Sami Kerola <kerolasa@iki.fi> wrote:
>>>> At the moment util-linux command are not threading, which means they can
>>>> safely use thread-unsafe IO system calls which should make printing
>>>> quicker.
>>>
>>> Do you have numbers about the assumption that this will produce better
>>> results on Linux?
>>>
>>> Uncontended mutexes/futexes on Linux probably might not really show
>>> up. Maybe in inner loops, not sure. Would be nice to know ...
>>
>> I did not do much testing, and to be honest results were slightly
>> disappointing. With simple 'time command < big_file' most of the
>> commands did not show measurable difference, but as a junior
>> programmer I thought the _unlocked would be beneficial for single
>> thread programs. As such assumptions are not preferred I will set up
>> some sort of test, which will try to accomplish what is the difference
>> of each locked vs _unlocked function call with various output sizes.
>> Assuming I get the test right it should not be a big deal to run it on
>> various systems I have access.
>
> Here is a bit of the background, which explains a bit why uncontended
> futexes (which is always the case in single-threaded programs) might
> not really make a difference on common Linux architectures. They will
> not even involve the kernel, just a simple instruction:
>   http://lwn.net/Articles/360699/

Hello Kay, Karel, and others who like statistics,

This is how I created numbers, and analysed them.

http://www.iki.fi/kerolasa/locked_vs_unlocked_io.tar.xz

Replicating results should be easy enough.  Other than the usual
developer tools I used R to visualize the numbers.  I have doubts my test
is measuring something else than what I hope it to measure, if so
comments about bias are welcome.

When I look the measurement

http://www.iki.fi/kerolasa/locked_vs_unlocked_io.png

it does, and doesn't, make sense.  As one could expect unlocked IO is
slightly quicker, when comparing mean run time.  But locked IO has much
more predictable run time, although some requests form quite long tail of
slow runs.  When looking slow runs the unlocked tail is heavier.

Conclusion.  Maybe my test is broken, or performance characteristics of
these two functions are dissimilar enough that comparison is a bit like
with apples and oranges.

--
Sami Kerola
http://www.iki.fi/kerolasa/

  reply	other threads:[~2013-07-13 22:11 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-07 19:54 [PATCH 00/34] pull: make printing quicker, and clang analysis Sami Kerola
2013-07-07 19:54 ` [PATCH 01/34] sfdisk: make unhiding as complete as possible Sami Kerola
2013-07-07 19:54 ` [PATCH 02/34] docs: add missing options to sfdisk manual Sami Kerola
2013-07-07 19:54 ` [PATCH 03/34] include: copy unlocked-io.h from gnulib Sami Kerola
2013-07-08 20:21   ` Kay Sievers
2013-07-09  6:37     ` Sami Kerola
2013-07-09  9:16       ` Kay Sievers
2013-07-13 22:10         ` Sami Kerola [this message]
2013-07-07 19:54 ` [PATCH 04/34] hexdump: use unlocked io, and avoid use of printf() Sami Kerola
2013-07-07 19:54 ` [PATCH 05/34] text-utils: use unlocked io Sami Kerola
2013-07-07 19:54 ` [PATCH 06/34] misc-utils: " Sami Kerola
2013-07-07 19:54 ` [PATCH 07/34] scriptreplay: " Sami Kerola
2013-07-07 19:54 ` [PATCH 09/34] utmpdump: use unlocked io, and avoid use of printf() Sami Kerola
2013-07-07 19:54 ` [PATCH 10/34] dmesg: inform user --show-delta and iso8601 time format does not mix Sami Kerola
2013-07-07 19:54 ` [PATCH 11/34] lib/loopdev: assigned value is never read [clang-analyzer] Sami Kerola
2013-07-07 19:54 ` [PATCH 12/34] lib/mbsalign: initializations values are " Sami Kerola
2013-07-07 19:54 ` [PATCH 13/34] libmount: fix memory leak [clang-analyzer] Sami Kerola
2013-07-08  8:02   ` Karel Zak
2013-07-07 19:54 ` [PATCH 14/34] ipcs: assigned values are never read [clang-analyzer] Sami Kerola
2013-07-07 19:54 ` [PATCH 15/34] lscpu: fix memory leak [clang-analyzer] Sami Kerola
2013-07-07 19:54 ` [PATCH 16/34] more: assigned value is never read [clang-analyzer] Sami Kerola
2013-07-07 19:54 ` [PATCH 17/34] utmpdump: assigned values are " Sami Kerola
2013-07-07 19:54 ` [PATCH 18/34] mkfs.cramfs: argument to free() is a constant address [clang-analyzer] Sami Kerola
2013-07-07 19:54 ` [PATCH 19/34] eject: assigned value is never read [clang-analyzer] Sami Kerola
2013-07-07 19:54 ` [PATCH 20/34] chfn: " Sami Kerola
2013-07-07 19:54 ` [PATCH 21/34] mesg: " Sami Kerola
2013-07-08  8:23   ` Karel Zak
2013-07-07 19:54 ` [PATCH 22/34] rev: " Sami Kerola
2013-07-07 19:54 ` [PATCH 23/34] column: " Sami Kerola
2013-07-07 19:54 ` [PATCH 24/34] hwclock: " Sami Kerola
2013-07-07 19:54 ` [PATCH 25/34] dmesg: " Sami Kerola
2013-07-07 19:54 ` [PATCH 26/34] login: " Sami Kerola
2013-07-07 19:54 ` [PATCH 27/34] sfdisk: " Sami Kerola
2013-07-07 19:54 ` [PATCH 28/34] sulogin: fix memory leak [clang-analyzer] Sami Kerola
2013-07-07 19:54 ` [PATCH 29/34] agetty: " Sami Kerola
2013-07-07 19:54 ` [PATCH 30/34] dmesg: add missing initializer [clang-analyzer] Sami Kerola
2013-07-07 19:54 ` [PATCH 31/34] ul: use correct types Sami Kerola
2013-07-07 19:54 ` [PATCH 32/34] ul: use string printing function Sami Kerola
2013-07-07 19:54 ` [PATCH 33/34] column: dereference of null pointer [clang-analyzer] Sami Kerola
2013-07-07 19:54 ` [PATCH 34/34] more: use variable lenght printf field width to print blanks Sami Kerola
2013-07-09 12:58 ` [PATCH 00/34] pull: make printing quicker, and clang analysis Karel Zak

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='CAG27Bk2Oh+D9=H06a-L_4AccUqOsFPRpd9nfAEcXZkavzZM36Q@mail.gmail.com' \
    --to=kerolasa@iki.fi \
    --cc=kay@vrfy.org \
    --cc=kerolasa@gmail.com \
    --cc=util-linux@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 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.