From: Andrew Morton <akpm@linux-foundation.org>
To: Wonhyuk Yang <vvghjk1234@gmail.com>
Cc: Mel Gorman <mgorman@suse.de>, Ohhoon Kwon <ohkwon1043@gmail.com>,
JaeSang Yoo <jsyoo5b@gmail.com>,
Jiyoup Kim <lakroforce@gmail.com>,
Donghyeok Kim <dthex5d@gmail.com>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm/page_alloc: cache the result of node_dirty_ok()
Date: Sat, 30 Apr 2022 11:38:43 -0700 [thread overview]
Message-ID: <20220430113843.7350160cf329e2a732e1cb94@linux-foundation.org> (raw)
In-Reply-To: <20220430011032.64071-1-vvghjk1234@gmail.com>
On Sat, 30 Apr 2022 10:10:32 +0900 Wonhyuk Yang <vvghjk1234@gmail.com> wrote:
> To spread dirty page, nodes are checked whether
> it reached the dirty limit using the expensive
> node_dirty_ok(). To reduce the number of calling
> node_dirty_ok(), last node that hit the dirty
> limit is cached.
>
> Instead of caching the node, caching both node
> and it's result of node_dirty_ok() can reduce
> the number of calling node_dirty_ok() more than
> before.
>
> ...
>
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -4068,7 +4068,8 @@ get_page_from_freelist(gfp_t gfp_mask, unsigned int order, int alloc_flags,
> {
> struct zoneref *z;
> struct zone *zone;
> - struct pglist_data *last_pgdat_dirty_limit = NULL;
> + struct pglist_data *last_pgdat = NULL;
> + bool last_pgdat_dirty_limit = false;
> bool no_fallback;
>
> retry:
> @@ -4107,13 +4108,13 @@ get_page_from_freelist(gfp_t gfp_mask, unsigned int order, int alloc_flags,
> * dirty-throttling and the flusher threads.
> */
> if (ac->spread_dirty_pages) {
> - if (last_pgdat_dirty_limit == zone->zone_pgdat)
> - continue;
> + if (last_pgdat != zone->zone_pgdat) {
> + last_pgdat = zone->zone_pgdat;
> + last_pgdat_dirty_limit = node_dirty_ok(zone->zone_pgdat);
> + }
>
> - if (!node_dirty_ok(zone->zone_pgdat)) {
> - last_pgdat_dirty_limit = zone->zone_pgdat;
> + if (!last_pgdat_dirty_limit)
> continue;
> - }
> }
>
> if (no_fallback && nr_online_nodes > 1 &&
Looks reasonable to me. Hopefully Mel and Johannes can review.
I think last_pgdat_dirty_limit isn't a great name. It records the
dirty_ok state of last_pgdat. So why not call it last_pgdat_dirty_ok?
--- a/mm/page_alloc.c~mm-page_alloc-cache-the-result-of-node_dirty_ok-fix
+++ a/mm/page_alloc.c
@@ -4022,7 +4022,7 @@ get_page_from_freelist(gfp_t gfp_mask, u
struct zoneref *z;
struct zone *zone;
struct pglist_data *last_pgdat = NULL;
- bool last_pgdat_dirty_limit = false;
+ bool last_pgdat_dirty_ok = false;
bool no_fallback;
retry:
@@ -4063,10 +4063,10 @@ retry:
if (ac->spread_dirty_pages) {
if (last_pgdat != zone->zone_pgdat) {
last_pgdat = zone->zone_pgdat;
- last_pgdat_dirty_limit = node_dirty_ok(zone->zone_pgdat);
+ last_pgdat_dirty_ok = node_dirty_ok(zone->zone_pgdat);
}
- if (!last_pgdat_dirty_limit)
+ if (!last_pgdat_dirty_ok)
continue;
}
_
next prev parent reply other threads:[~2022-04-30 18:38 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-30 1:10 Wonhyuk Yang
2022-04-30 18:38 ` Andrew Morton [this message]
2022-05-02 9:53 ` Mel Gorman
2022-05-03 16:19 ` Johannes Weiner
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=20220430113843.7350160cf329e2a732e1cb94@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=dthex5d@gmail.com \
--cc=jsyoo5b@gmail.com \
--cc=lakroforce@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mgorman@suse.de \
--cc=ohkwon1043@gmail.com \
--cc=vvghjk1234@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