From: Michal Hocko <mhocko@suse.com>
To: Wei Yang <richard.weiyang@gmail.com>
Cc: akpm@linux-foundation.org, mgorman@techsingularity.net,
linux-mm@kvack.org
Subject: Re: [PATCH] mm, page_alloc: skip zone who has no managed_pages in calculate_totalreserve_pages()
Date: Tue, 13 Nov 2018 10:07:58 +0100 [thread overview]
Message-ID: <20181113090758.GL15120@dhcp22.suse.cz> (raw)
In-Reply-To: <20181113081644.giu5vxhsfqjqlexh@master>
On Tue 13-11-18 08:16:44, Wei Yang wrote:
> On Tue, Nov 13, 2018 at 09:08:34AM +0100, Michal Hocko wrote:
> >On Tue 13-11-18 01:39:42, Wei Yang wrote:
> >> On Mon, Nov 12, 2018 at 03:40:20PM +0100, Michal Hocko wrote:
> >> >On Mon 12-11-18 14:26:41, Wei Yang wrote:
> >> >> On Mon, Nov 12, 2018 at 09:09:26AM +0100, Michal Hocko wrote:
> >> >> >On Mon 12-11-18 15:14:04, Wei Yang wrote:
> >> >> >> Zone with no managed_pages doesn't contribute totalreserv_pages. And the
> >> >> >> more nodes we have, the more empty zones there are.
> >> >> >>
> >> >> >> This patch skip the zones to save some cycles.
> >> >> >
> >> >> >What is the motivation for the patch? Does it really cause any
> >> >> >measurable difference in performance?
> >> >> >
> >> >>
> >> >> The motivation here is to reduce some unnecessary work.
> >> >
> >> >I have guessed so even though the changelog was quite modest on the
> >> >motivation.
> >> >
> >> >> Based on my understanding, almost every node has empty zones, since
> >> >> zones within a node are ordered in monotonic increasing memory address.
> >> >
> >> >Yes, this is likely the case. Btw. a check for populated_zone or
> >> >for_each_populated_zone would suite much better.
> >> >
> >>
> >> Hmm... maybe not exact.
> >>
> >> populated_zone checks zone->present_pages
> >> managed_zone checks zone->managed_pages
> >>
> >> As the comment of managed_zone says, this one records the pages managed
> >> by buddy system. And when we look at the usage of totalreserve_pages, it
> >> is only used in page allocation. And finally, *max* is checked with
> >> managed_pages instead of present_pages.
> >>
> >> Because of this, managed_zone is more accurate at this place. Is my
> >> understanding correct?
> >
> >OK, fair enough. There is a certain discrepancy here. You are right that
> >we do not care about pages out of the page allocator scope (e.g. early
> >bootmem allocations, struct pages) but this is likely what other callers
> >of populated_zone are looking for as well. It seems that managed pages
> >counter which only came in later was not considered in other places.
> >
> >That being said this asks for a cleanup of some sort. And I think such a
> >cleanup wold be appreciated much more than an optimization of an unknown
> >effect and wonder why this check is used here and not at other places.
>
> You are right. There are three pages(spanned, managed, present) in a
> zone, which is a little confusing.
>
> So you are willing to get rid of present_pages, if I am right?
No, I believe we want all three of them. But reviewing
for_each_populated_zone users and explicit checks for present/managed
pages and unify them would be a step forward both a more optimal code
and more maintainable code. I haven't checked but
for_each_populated_zone would seem like a proper user for managed page
counter. But that really requires to review all current users.
--
Michal Hocko
SUSE Labs
next prev parent reply other threads:[~2018-11-13 9:08 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-12 7:14 Wei Yang
2018-11-12 8:09 ` Michal Hocko
2018-11-12 14:26 ` Wei Yang
2018-11-12 14:40 ` Michal Hocko
2018-11-13 1:39 ` Wei Yang
2018-11-13 8:08 ` Michal Hocko
2018-11-13 8:16 ` Wei Yang
2018-11-13 9:07 ` Michal Hocko [this message]
2018-11-13 9:14 ` Wei Yang
2018-11-14 7:43 ` Wei Yang
2018-11-14 7:48 ` Michal Hocko
2018-11-14 8:20 ` Wei Yang
2018-11-14 8:54 ` Michal Hocko
2018-11-13 3:11 ` [PATCH] mm, page_alloc: skip to set lowmem_reserve[] for empty zones 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=20181113090758.GL15120@dhcp22.suse.cz \
--to=mhocko@suse.com \
--cc=akpm@linux-foundation.org \
--cc=linux-mm@kvack.org \
--cc=mgorman@techsingularity.net \
--cc=richard.weiyang@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