linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Kefeng Wang <wangkefeng.wang@huawei.com>
Cc: <linux-mm@kvack.org>
Subject: Re: [PATCH] mm: compaction: refactor compact_node()
Date: Wed, 7 Feb 2024 15:48:24 -0800	[thread overview]
Message-ID: <20240207154824.38a8654fb396f790c2a7a3f8@linux-foundation.org> (raw)
In-Reply-To: <20240207095841.1648144-1-wangkefeng.wang@huawei.com>

On Wed, 7 Feb 2024 17:58:41 +0800 Kefeng Wang <wangkefeng.wang@huawei.com> wrote:

> Refactor compact_node() to handle both proactive and synchronous compact
> memory, which cleanups code a bit.

Looks good.

> + * Compact all zones within a node till each zone's fragmentation score
> + * reaches within proactive compaction thresholds (as determined by the
> + * proactiveness tunable).
> + *
> + * It is possible that the function returns before reaching score targets
> + * due to various back-off conditions, such as, contention on per-node or
> + * per-zone locks.
> + */
> +static void proactive_compact_node(pg_data_t *pgdat)
>  {
> -	pg_data_t *pgdat = NODE_DATA(nid);
> -	int zoneid;
> -	struct zone *zone;
> -	struct compact_control cc = {
> -		.order = -1,
> -		.mode = MIGRATE_SYNC,
> -		.ignore_skip_hint = true,
> -		.whole_zone = true,
> -		.gfp_mask = GFP_KERNEL,
> -	};
> -
> -
> -	for (zoneid = 0; zoneid < MAX_NR_ZONES; zoneid++) {
> -
> -		zone = &pgdat->node_zones[zoneid];
> -		if (!populated_zone(zone))
> -			continue;
> -
> -		cc.zone = zone;
> -
> -		compact_zone(&cc, NULL);
> -	}
> +	compact_node(pgdat, true);
>  }

I suggest that proactive_compact_node() be removed.  Move its comment
to compact_node(), add explanation of the bool argument to that comment
and open-code the call to compact_node() at proactive_compact_node()'s
sole call site.



  reply	other threads:[~2024-02-07 23:48 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-07  9:58 Kefeng Wang
2024-02-07 23:48 ` Andrew Morton [this message]
2024-02-08  2:25 ` [PATCH] mm: compaction: early termination in compact_nodes() Kefeng Wang
2024-02-08 21:14   ` Andrew Morton
2024-02-12 14:22     ` David Hildenbrand
2024-02-17  2:55       ` Kefeng Wang
2024-02-21 22:34         ` Andrew Morton
2024-02-22 14:36           ` Kefeng Wang

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=20240207154824.38a8654fb396f790c2a7a3f8@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=linux-mm@kvack.org \
    --cc=wangkefeng.wang@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox