From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Chia-I Wu <olvaffe@gmail.com>
Cc: amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
christian.koenig@amd.com, alexander.deucher@amd.com,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Alison Schofield <alison.schofield@intel.com>,
Dave Jiang <dave.jiang@intel.com>, Baoquan He <bhe@redhat.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] kernel/resource: optimize find_next_iomem_res
Date: Tue, 4 Jun 2024 17:31:50 +0200 [thread overview]
Message-ID: <2024060427-upstairs-jackal-b10a@gregkh> (raw)
In-Reply-To: <20240531053704.2009827-1-olvaffe@gmail.com>
On Thu, May 30, 2024 at 10:36:57PM -0700, Chia-I Wu wrote:
> We can skip children resources when the parent resource does not cover
> the range.
>
> This should help vmf_insert_* users on x86, such as several DRM drivers.
> On my AMD Ryzen 5 7520C, when streaming data from cpu memory into amdgpu
> bo, the throughput goes from 5.1GB/s to 6.6GB/s. perf report says
>
> 34.69%--__do_fault
> 34.60%--amdgpu_gem_fault
> 34.00%--ttm_bo_vm_fault_reserved
> 32.95%--vmf_insert_pfn_prot
> 25.89%--track_pfn_insert
> 24.35%--lookup_memtype
> 21.77%--pat_pagerange_is_ram
> 20.80%--walk_system_ram_range
> 17.42%--find_next_iomem_res
>
> before this change, and
>
> 26.67%--__do_fault
> 26.57%--amdgpu_gem_fault
> 25.83%--ttm_bo_vm_fault_reserved
> 24.40%--vmf_insert_pfn_prot
> 14.30%--track_pfn_insert
> 12.20%--lookup_memtype
> 9.34%--pat_pagerange_is_ram
> 8.22%--walk_system_ram_range
> 5.09%--find_next_iomem_res
>
> after.
That's great, but why is walk_system_ram_range() being called so often?
Shouldn't that be a "set up the device" only type of thing? Why hammer
on "lookup_memtype" when you know the memtype, you just did the same
thing for the previous frame.
This feels like it could be optimized to just "don't call these things"
which would make it go faster, right?
What am I missing here, why does this always have to be calculated all
the time? Resource mapping changes are rare, if at all, over the
lifetime of a system uptime. Constantly calculating something that
never changes feels odd to me.
thanks,
greg k-h
next prev parent reply other threads:[~2024-06-04 15:41 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-31 5:36 [PATCH] kernel/resource: optimize find_next_iomem_res Chia-I Wu
2024-05-31 8:57 ` Andy Shevchenko
[not found] ` <CAPaKu7SsD+X7KAO=3vEYU_7YGM_f+7k1fdC9nEK=-NaJw8oYaA@mail.gmail.com>
2024-06-02 9:06 ` Andy Shevchenko
2024-06-03 7:24 ` Ilpo Järvinen
2024-06-04 5:04 ` Chia-I Wu
2024-06-03 7:28 ` Ilpo Järvinen
2024-05-31 15:32 ` Andy Shevchenko
2024-06-04 15:31 ` Greg Kroah-Hartman [this message]
2024-06-04 21:37 ` Chia-I Wu
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=2024060427-upstairs-jackal-b10a@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=alexander.deucher@amd.com \
--cc=alison.schofield@intel.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=andriy.shevchenko@linux.intel.com \
--cc=bhe@redhat.com \
--cc=christian.koenig@amd.com \
--cc=dave.jiang@intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=olvaffe@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