Re: [PATCH] mm: compaction: refactor compact_node()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 7 Feb 2024 17:58:41 +0800 Kefeng Wang <wangkefeng.wang@xxxxxxxxxx> 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.





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux