linux-cifs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Enzo Matsumiya <ematsumiya@suse.de>
To: "Aurélien Aptel" <aurelien.aptel@gmail.com>
Cc: linux-cifs@vger.kernel.org, smfrench@gmail.com, pc@cjr.nz,
	ronniesahlberg@gmail.com, nspmangalore@gmail.com
Subject: Re: [PATCH] cifs: perf improvement - use faster macros ALIGN() and round_up()
Date: Wed, 7 Sep 2022 15:15:04 -0300	[thread overview]
Message-ID: <20220907181504.slrof5u42vijakje@cyberdelia> (raw)
In-Reply-To: <CA+5B0FNBJVFC6-SfVodctu0DkyyZ9DzJM8OJsDBbVb453Mvfsw@mail.gmail.com>

Hi Aurelien,

On 09/07, Aurélien Aptel wrote:
>Hi,
>
>Changes are good from a readability stand point but like the others
>I'm very skeptical about the perf improvement claims.

I also am/was. That's why I ran 5 times each test after sending the
patch. For each run, I made sure to have the mount point clean, both
server and client freshly booted, and aside from the patch, the build
env/compile options were exactly the same.

The server had no parallel workload at all as it's only a test server.

>Many of these compile to the same division-less instructions
>especially if any of the values are known at compile time.

<snip>

>> @@ -2826,9 +2819,7 @@ SMB2_open_init(struct cifs_tcon *tcon, struct TCP_Server_Info *server,
>> -               copy_size = uni_path_len;
>> -               if (copy_size % 8 != 0)
>> -                       copy_size = roundup(copy_size, 8);
>> +               copy_size = round_up(uni_path_len, 8);
>> @@ -4090,7 +4081,7 @@ smb2_new_read_req(void **buf, unsigned int *total_len,
>> -                       *total_len = DIV_ROUND_UP(*total_len, 8) * 8;
>> +                       *total_len = ALIGN(*total_len, 8);
>
>These 2 are also hot paths, but skeptical about the optimizations.

As you point out, SMB2_open_init() was indeed the function with greater
improvement, and as per my measurements, the one that actually impacted
the general latency.

>I've looked at those macros in Compiler Explorer and sure enough they
>compile to the same thing on x86_64.
>Even worse, the optimized versions compile with extra instructions for some:
>
>https://godbolt.org/z/z1xhhW9sj

I did the same comparison on a userspace program and got similar
results, but I didn't bother to check the kernel objects as testing it
was quicker to me. But I'll do it today.

>I suspect the improvements are more likely to be related to caches,
>system load, server load, ...

See above.

>You can try to use perf to make a flamegraph and compare.
>
>Cheers,

Not really used to perf, but will check it out, thanks!


Cheers,

Enzo

  reply	other threads:[~2022-09-07 18:15 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-06  1:30 [PATCH] cifs: perf improvement - use faster macros ALIGN() and round_up() Enzo Matsumiya
2022-09-06  2:36 ` ronnie sahlberg
2022-09-06 14:41   ` Enzo Matsumiya
2022-09-06 15:47     ` Tom Talpey
2022-09-06 16:05       ` Enzo Matsumiya
2022-09-07  8:37 ` Aurélien Aptel
2022-09-07 18:15   ` Enzo Matsumiya [this message]
2022-09-07 20:41   ` Enzo Matsumiya
2022-09-14  2:50     ` Steve French
2022-09-14 14:38       ` Enzo Matsumiya

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=20220907181504.slrof5u42vijakje@cyberdelia \
    --to=ematsumiya@suse.de \
    --cc=aurelien.aptel@gmail.com \
    --cc=linux-cifs@vger.kernel.org \
    --cc=nspmangalore@gmail.com \
    --cc=pc@cjr.nz \
    --cc=ronniesahlberg@gmail.com \
    --cc=smfrench@gmail.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).