linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Tarun Sahu <tsahu@linux.ibm.com>
To: alexlzhu@fb.com, linux-mm@kvack.org, kernel-team@fb.com
Cc: willy@infradead.org, hannes@cmpxchg.org, riel@surriel.com,
	yuzhao@google.com, ningzhang@linux.alibaba.com,
	Alexander Zhu <alexlzhu@fb.com>
Subject: Re: [PATCH v6 5/5] mm: THP low utilization shrinker
Date: Fri, 06 Jan 2023 19:11:36 +0530	[thread overview]
Message-ID: <87pmbrok4v.fsf@linux.ibm.com> (raw)
In-Reply-To: <f4bd941ff7406ebad57ad7f47e7788ef12c6eb46.1667454613.git.alexlzhu@fb.com>


Hi Alex,

I think it would better to have the 90% under utilization threshold for
shrinker to be defined as macro rather than hard coded?

like,

/*
 * The threshold to determine if thp is under utilized and can be
 * shrunk.
 */
#define THP_NRML_UTILIZED_BUCKET THP_UTIL_BUCKET_NR - 1

This way, it is more clear.

--skip
> +bool can_shrink_thp(struct folio *folio)
> +{
> +	int bucket, num_utilized_pages;
> +
> +	if (!folio || !folio_test_anon(folio) || !folio_test_transhuge(folio))
> +		return false;
> +
> +	num_utilized_pages = thp_number_utilized_pages(folio);
> +	bucket = thp_utilization_bucket(num_utilized_pages);
> +
> +	return bucket >= 0 && bucket < THP_UTIL_BUCKET_NR - 1;
This can be

         return bucket >= 0 && bucket < THP_NRML_UTILIZED_BUCKET;



> +}
> +
>  static void thp_scan_next_zone(void)
>  {
>  	struct timespec64 current_time;
> @@ -170,6 +183,9 @@ static void thp_util_scan(unsigned long pfn_end)
>  		if (bucket < 0)
>  			continue;
>  
> +		if (bucket < THP_UTIL_BUCKET_NR - 1)
Similarly, this one.

There might be other instances too.
> +			add_underutilized_thp(page);
> +
>  		thp_scan.buckets[bucket].nr_thps++;
>  		thp_scan.buckets[bucket].nr_zero_pages += (HPAGE_PMD_NR - num_utilized_pages);
>  	}
> -- 
> 2.30.2


  parent reply	other threads:[~2023-01-06 13:42 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-03  6:01 [PATCH v6 0/5] THP Shrinker alexlzhu
2022-11-03  6:01 ` [PATCH v6 1/5] mm: add thp_utilization metrics to debugfs alexlzhu
2022-11-03  6:01 ` [PATCH v6 2/5] mm: changes to split_huge_page() to free zero filled tail pages alexlzhu
2022-11-03  6:01 ` [PATCH v6 3/5] mm: do not remap clean subpages when splitting isolated thp alexlzhu
2022-11-03 12:48   ` kernel test robot
2022-11-03 13:19   ` kernel test robot
2022-11-03  6:01 ` [PATCH v6 4/5] mm: add selftests to split_huge_page() to verify unmap/zap of zero pages alexlzhu
2022-11-03  6:01 ` [PATCH v6 5/5] mm: THP low utilization shrinker alexlzhu
2022-11-03 13:19   ` kernel test robot
2023-01-06 13:41   ` Tarun Sahu [this message]
2023-01-02 18:05 ` [PATCH v6 0/5] THP Shrinker David Hildenbrand

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=87pmbrok4v.fsf@linux.ibm.com \
    --to=tsahu@linux.ibm.com \
    --cc=alexlzhu@fb.com \
    --cc=hannes@cmpxchg.org \
    --cc=kernel-team@fb.com \
    --cc=linux-mm@kvack.org \
    --cc=ningzhang@linux.alibaba.com \
    --cc=riel@surriel.com \
    --cc=willy@infradead.org \
    --cc=yuzhao@google.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