Re: [PATCH mm-unstable v1 2/4] mm/mglru: try to stop at high watermarks

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

 



On Thu,  7 Dec 2023 23:14:05 -0700 Yu Zhao <yuzhao@xxxxxxxxxx>
> -static unsigned long get_nr_to_reclaim(struct scan_control *sc)
> +static bool should_abort_scan(struct lruvec *lruvec, struct scan_control *sc)
>  {
> +	int i;
> +	enum zone_watermarks mark;
> +
>  	/* don't abort memcg reclaim to ensure fairness */
>  	if (!root_reclaim(sc))
> -		return -1;
> +		return false;
>  
> -	return max(sc->nr_to_reclaim, compact_gap(sc->order));
> +	if (sc->nr_reclaimed >= max(sc->nr_to_reclaim, compact_gap(sc->order)))
> +		return true;
> +
> +	/* check the order to exclude compaction-induced reclaim */
> +	if (!current_is_kswapd() || sc->order)
> +		return false;
> +
> +	mark = sysctl_numa_balancing_mode & NUMA_BALANCING_MEMORY_TIERING ?
> +	       WMARK_PROMO : WMARK_HIGH;
> +
> +	for (i = 0; i <= sc->reclaim_idx; i++) {
> +		struct zone *zone = lruvec_pgdat(lruvec)->node_zones + i;
> +		unsigned long size = wmark_pages(zone, mark) + MIN_LRU_BATCH;
> +
> +		if (managed_zone(zone) && !zone_watermark_ok(zone, 0, size, sc->reclaim_idx, 0))
> +			return false;
> +	}
> +
> +	/* kswapd should abort if all eligible zones are safe */

This comment does not align with 86c79f6b5426
("mm: vmscan: do not reclaim from kswapd if there is any eligible zone").
Any thing special here?

> +	return true;
>  }




[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux