All of lore.kernel.org
 help / color / mirror / Atom feed
From: Juan Quintela <quintela@redhat.com>
To: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
Cc: peter.maydell@linaro.org, qemu-devel@nongnu.org,
	"Eduardo Habkost" <eduardo@habkost.net>,
	"Peter Xu" <peterx@redhat.com>,
	"Philippe Mathieu-Daudé" <f4bug@amsat.org>,
	"Yanan Wang" <wangyanan55@huawei.com>,
	"Leonardo Bras" <leobras@redhat.com>,
	"Marcel Apfelbaum" <marcel.apfelbaum@gmail.com>,
	"Richard Henderson" <rth@twiddle.net>
Subject: Re: [PATCH v6 02/13] multifd: Create page_size fields into both MultiFD{Recv,Send}Params
Date: Wed, 18 May 2022 10:48:15 +0200	[thread overview]
Message-ID: <874k1ngrao.fsf@secure.mitica> (raw)
In-Reply-To: <YoNgVHf4frHI05m8@work-vm> (David Alan Gilbert's message of "Tue,  17 May 2022 09:44:04 +0100")

"Dr. David Alan Gilbert" <dgilbert@redhat.com> wrote:
> * Juan Quintela (quintela@redhat.com) wrote:
>> We were calling qemu_target_page_size() left and right.
>> 
>> Signed-off-by: Juan Quintela <quintela@redhat.com>

[Adding Richard]

> (Copying in Peter Maydell)
> Your problem here is most of these files are target independent
> so you end up calling the qemu_target_page_size functions, which I guess
> you're seeing popup in some perf trace?
> I mean they're trivial functions but I guess you do get the function
> call.

Hi

There are several problems here:

- Richard complained in previous reviews that we were calling
  qemu_target_page_size() inside loops or more than once per function
  (He was right)

- qemu_target_page_size() name is so long that basically means that I
  had to split the line for each appearance.

- All migration code assumes that the value is constant for a current
  migration, it can change.

So I decided to cache the value in the structure and call it a day.  The
same for the other page_count field.

I have never seen that function on a performance profile, so this is
just a taste/aesthetic issue.

I think your patch is still good, but it don't cover any of the issues
that I just listed.

Thanks, Juan.


>
> I wonder about the following patch instead
> (Note i've removed the const on the structure here); I wonder how this
> does performance wise for everyone:
>
>
> From abc7da46736b18b6138868ccc0b11901169e1dfd Mon Sep 17 00:00:00 2001
> From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
> Date: Mon, 16 May 2022 19:54:31 +0100
> Subject: [PATCH] target-page: Maintain target_page variable even for
>  non-variable
> Content-type: text/plain
>
> On architectures that define TARGET_PAGE_BITS_VARY, the 'target_page'
> structure gets filled in at run time by the number of bits and the
> TARGET_PAGE_BITS and TARGET_PAGE macros use that rather than being
> constant.
>
> On non-variable pagesize systems target_page is not filled in, and we
> rely on TARGET_PAGE_SIZE being compile time defined.
>
> The problem is that for source files that are target-independent
> they end up calling qemu_target_page_size to read the size, and that
> function call is annoying.
>
> Improve this by always filling in 'target_page' even for non-variable
> size CPUs, and inlining the functions that previously returned
> the macro values (that may have been constant) to return the
> values read from target_page.
>
> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>



  reply	other threads:[~2022-05-18  9:00 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-10 22:42 [PATCH v6 00/13] Migration: Transmit and detect zero pages in the multifd threads Juan Quintela
2022-05-10 22:42 ` [PATCH v6 01/13] multifd: Document the locking of MultiFD{Send/Recv}Params Juan Quintela
2022-05-16 13:14   ` Dr. David Alan Gilbert
2022-05-18  8:40     ` Juan Quintela
2022-05-10 22:42 ` [PATCH v6 02/13] multifd: Create page_size fields into both MultiFD{Recv, Send}Params Juan Quintela
2022-05-17  8:44   ` [PATCH v6 02/13] multifd: Create page_size fields into both MultiFD{Recv,Send}Params Dr. David Alan Gilbert
2022-05-18  8:48     ` Juan Quintela [this message]
2022-05-10 22:42 ` [PATCH v6 03/13] multifd: Create page_count fields into both MultiFD{Recv, Send}Params Juan Quintela
2022-05-10 22:42 ` [PATCH v6 04/13] migration: Export ram_transferred_ram() Juan Quintela
2022-05-10 22:42 ` [PATCH v6 05/13] multifd: Count the number of bytes sent correctly Juan Quintela
2022-05-10 22:42 ` [PATCH v6 06/13] migration: Make ram_save_target_page() a pointer Juan Quintela
2022-05-10 22:42 ` [PATCH v6 07/13] multifd: Make flags field thread local Juan Quintela
2022-05-10 22:42 ` [PATCH v6 08/13] multifd: Prepare to send a packet without the mutex held Juan Quintela
2022-05-10 22:42 ` [PATCH v6 09/13] multifd: Add property to enable/disable zero_page Juan Quintela
2022-05-10 22:42 ` [PATCH v6 10/13] migration: Export ram_release_page() Juan Quintela
2022-05-10 22:42 ` [PATCH v6 11/13] multifd: Support for zero pages transmission Juan Quintela
2022-05-10 22:42 ` [PATCH v6 12/13] multifd: Zero " Juan Quintela
2022-05-10 22:42 ` [PATCH v6 13/13] migration: Use multifd before we check for the zero page Juan Quintela
2022-05-12 13:40 ` [PATCH v6 00/13] Migration: Transmit and detect zero pages in the multifd threads Dr. David Alan Gilbert
2022-05-16 10:45   ` Juan Quintela

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=874k1ngrao.fsf@secure.mitica \
    --to=quintela@redhat.com \
    --cc=dgilbert@redhat.com \
    --cc=eduardo@habkost.net \
    --cc=f4bug@amsat.org \
    --cc=leobras@redhat.com \
    --cc=marcel.apfelbaum@gmail.com \
    --cc=peter.maydell@linaro.org \
    --cc=peterx@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    --cc=wangyanan55@huawei.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 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.