From: Michal Hocko <mhocko@kernel.org>
To: Wei Yang <richardw.yang@linux.intel.com>
Cc: Vlastimil Babka <vbabka@suse.cz>,
akpm@linux-foundation.org, kirill.shutemov@linux.intel.com,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm/mmap.c: refine data locality of find_vma_prev
Date: Wed, 7 Aug 2019 09:51:01 +0200 [thread overview]
Message-ID: <20190807075101.GN11812@dhcp22.suse.cz> (raw)
In-Reply-To: <20190807003109.GB24750@richard>
On Wed 07-08-19 08:31:09, Wei Yang wrote:
> On Tue, Aug 06, 2019 at 11:29:52AM +0200, Vlastimil Babka wrote:
> >On 8/6/19 10:11 AM, Wei Yang wrote:
> >> When addr is out of the range of the whole rb_tree, pprev will points to
> >> the biggest node. find_vma_prev gets is by going through the right most
> >
> >s/biggest/last/ ? or right-most?
> >
> >> node of the tree.
> >>
> >> Since only the last node is the one it is looking for, it is not
> >> necessary to assign pprev to those middle stage nodes. By assigning
> >> pprev to the last node directly, it tries to improve the function
> >> locality a little.
> >
> >In the end, it will always write to the cacheline of pprev. The caller has most
> >likely have it on stack, so it's already hot, and there's no other CPU stealing
> >it. So I don't understand where the improved locality comes from. The compiler
> >can also optimize the patched code so the assembly is identical to the previous
> >code, or vice versa. Did you check for differences?
>
> Vlastimil
>
> Thanks for your comment.
>
> I believe you get a point. I may not use the word locality. This patch tries
> to reduce some unnecessary assignment of pprev.
>
> Original code would assign the value on each node during iteration, this is
> what I want to reduce.
Is there any measurable difference (on micro benchmarks or regular
workloads)?
--
Michal Hocko
SUSE Labs
next prev parent reply other threads:[~2019-08-07 7:51 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-06 8:11 [PATCH] mm/mmap.c: refine data locality of find_vma_prev Wei Yang
2019-08-06 9:29 ` Vlastimil Babka
2019-08-07 0:31 ` Wei Yang
2019-08-07 7:51 ` Michal Hocko [this message]
2019-08-08 3:26 ` Wei Yang
2019-08-08 6:02 ` Michal Hocko
2019-08-08 8:44 ` Wei Yang
2019-08-08 8:49 ` Vlastimil Babka
2019-08-08 14:33 ` Wei Yang
2019-08-06 10:58 ` Balbir Singh
2019-08-07 0:32 ` Wei Yang
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=20190807075101.GN11812@dhcp22.suse.cz \
--to=mhocko@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=kirill.shutemov@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=richardw.yang@linux.intel.com \
--cc=vbabka@suse.cz \
/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).